def IndexXmlForQuery(kind, ancestor, props):
 serialized_xml = []
 serialized_xml.append(('  <datastore-index kind="%s" ancestor="%s">' % (kind, ('true' if ancestor else 'false'))))
 for (name, direction) in props:
  serialized_xml.append(('    <property name="%s" direction="%s" />' % (name, ('asc' if (direction == ASCENDING) else 'desc'))))
 serialized_xml.append('  </datastore-index>')
 return '\n'.join(serialized_xml)

def IndexXmlForQuery ( kind , ancestor , props ) : serialized_xml = [ ] serialized_xml . append ( ( '  <datastore-index kind="%s" ancestor="%s">' % ( kind , ( 'true' if ancestor else 'false' ) ) ) ) for ( name , direction ) in props : serialized_xml . append ( ( '    <property name="%s" direction="%s" />' % ( name , ( 'asc' if ( direction == ASCENDING ) else 'desc' ) ) ) ) serialized_xml . append ( '  </datastore-index>' ) return '\n' . join ( serialized_xml )
return the composite index definition xml needed for a query .