code: def etree_to_string(root, pretty_print=True, xml_declaration=True,
                      encoding='utf-8'):
      
      return etree.tostring(
          root,
          pretty_print=pretty_print,
          xml_declaration=xml_declaration,
          encoding=encoding,
      ).decode('utf-8')
docs: Dump XML etree as a string.