def _indent_xml(xml, prefix=u''):
 if (len(xml) > 0):
  xml.text = ((((xml.text or u'').strip() + u'\n') + prefix) + u'  ')
  for child in xml:
   _indent_xml(child, (prefix + u'  '))
  for child in xml[:(-1)]:
   child.tail = ((((child.tail or u'').strip() + u'\n') + prefix) + u'  ')
  xml[(-1)].tail = (((xml[(-1)].tail or u'').strip() + u'\n') + prefix)

def _indent_xml ( xml , prefix = u'' ) : if ( len ( xml ) > 0 ) : xml . text = ( ( ( ( xml . text or u'' ) . strip ( ) + u'\n' ) + prefix ) + u'  ' ) for child in xml : _indent_xml ( child , ( prefix + u'  ' ) ) for child in xml [ : ( - 1 ) ] : child . tail = ( ( ( ( child . tail or u'' ) . strip ( ) + u'\n' ) + prefix ) + u'  ' ) xml [ ( - 1 ) ] . tail = ( ( ( xml [ ( - 1 ) ] . tail or u'' ) . strip ( ) + u'\n' ) + prefix )
helper for build_index(): given an xml elementtree .