def _get_xml_iter(xml_source):
 if (not hasattr(xml_source, 'read')):
  try:
   xml_source = xml_source.encode('utf-8')
  except (AttributeError, UnicodeDecodeError):
   pass
  return BytesIO(xml_source)
 else:
  try:
   xml_source.seek(0)
  except:
   pass
  return xml_source

def _get_xml_iter ( xml_source ) : if ( not hasattr ( xml_source , 'read' ) ) : try : xml_source = xml_source . encode ( 'utf-8' ) except ( AttributeError , UnicodeDecodeError ) : pass return BytesIO ( xml_source ) else : try : xml_source . seek ( 0 ) except : pass return xml_source
possible inputs: strings .