def xml_prettify(elem):
 text = ET.tostring(elem, 'utf-8')
 reparsed = minidom.parseString(text)
 return reparsed.toprettyxml(indent=' ')

def xml_prettify ( elem ) : text = ET . tostring ( elem , 'utf-8' ) reparsed = minidom . parseString ( text ) return reparsed . toprettyxml ( indent = ' ' )
return a pretty-printed xml string for the xml element .