Censor Dispenser email two help!


I think I have made some progress on censoring email two of censor dispenser but I would like some feedback.

I have not yet accounted for the censor being the same length as the term, but I will update that. Besides, that am I on the right track? I get the output that I want but I am not accounting for all the cases such as multiple word terms starting with an upper case or ending with a period. I am not sure how to implement this.

def censor_two(body_of_text, proprietary_terms): 
  split_lines = body_of_text.split('\n')
  split_words = []
  for line in split_lines:
  for line in split_words:
    for i in range(len(line)):
      word = line[i]
      word = word.lower()
      if word.isalpha() == True and word in proprietary_terms:
        line[i] = '####'
        word_end = word[-1]
        word_start = word[:-1]
        if word_start in proprietary_terms:
          line[i] = '******' + word_end
  join_words = []
  for line in split_words:
    join_words.append(' '.join(line))
  join_lines = "\n".join(join_words)
  terms_replaced = []
  for t in range(len(proprietary_terms)):
    term_index = terms_replaced[t].find(proprietary_terms[t])
    print(proprietary_terms[t] + ":" + str(term_index))
    terms_replaced.append(terms_replaced[t].replace(' '+proprietary_terms[t]+' '," XXX "))
  return terms_replaced[-1]

Advice would be appreciated.