def _remove_unicode_encoding(xml_file):
 with open(xml_file, 'rb') as f:
  xml_content = f.read()
 modified_xml = re.sub(' encoding=[\\\'"]+unicode[\\\'"]+', '', xml_content.decode('utf-16'), count=1)
 xmltree = lxml.etree.parse(StringIO(modified_xml))
 return xmltree

def _remove_unicode_encoding ( xml_file ) : with open ( xml_file , 'rb' ) as f : xml_content = f . read ( ) modified_xml = re . sub ( ' encoding=[\\\'"]+unicode[\\\'"]+' , '' , xml_content . decode ( 'utf-16' ) , count = 1 ) xmltree = lxml . etree . parse ( StringIO ( modified_xml ) ) return xmltree
attempts to remove the "encoding=unicode" from an xml file as lxml does not support that on a windows node currently see issue #38100 .