def IndexYamlForQuery(kind, ancestor, props):
 serialized_yaml = []
 serialized_yaml.append(('- kind: %s' % kind))
 if ancestor:
  serialized_yaml.append('  ancestor: yes')
 if props:
  serialized_yaml.append('  properties:')
  for (name, direction) in props:
   serialized_yaml.append(('  - name: %s' % name))
   if (direction == DESCENDING):
    serialized_yaml.append('    direction: desc')
 return '\n'.join(serialized_yaml)

def IndexYamlForQuery ( kind , ancestor , props ) : serialized_yaml = [ ] serialized_yaml . append ( ( '- kind: %s' % kind ) ) if ancestor : serialized_yaml . append ( '  ancestor: yes' ) if props : serialized_yaml . append ( '  properties:' ) for ( name , direction ) in props : serialized_yaml . append ( ( '  - name: %s' % name ) ) if ( direction == DESCENDING ) : serialized_yaml . append ( '    direction: desc' ) return '\n' . join ( serialized_yaml )
return the composite index definition yaml needed for a query .