docs: def replace(document, search, replace):
      """
      Replace all occurences of string with a different string, return updated
      document
      """
      newdocument = document
      searchre = re.compile(search)
      for element in newdocument.iter():
          if element.tag == '{%s}t' % nsprefixes['w']:  # t (text) elements
              if element.text:
                  if searchre.search(element.text):
                      element.text = re.sub(search, replace, element.text)
      return newdocument