#NEWLINE# def IndexToKey( index ) : #NEWLINE# #INDENT# 'Convert Index to key.\n\n  Args:\n    index: A datastore_index.Index instance (not None!).\n\n  Returns:\n    A tuple of the form (kind, ancestor, properties) where properties\n    is a tuple of (name, direction) pairs, direction being ASCENDING\n    or DESCENDING (the enums).\n  ' #NEWLINE# props = [ ] #NEWLINE# if ( index . properties is not None ) : #NEWLINE# #INDENT# for prop in index . properties : #NEWLINE# #INDENT# if ( prop . direction == 'asc' ) : #NEWLINE# #INDENT# direction = ASCENDING #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# direction = DESCENDING #NEWLINE# #UNINDENT# props . append ( ( prop . name , direction ) ) #NEWLINE# #UNINDENT# #UNINDENT# return ( index . kind , index . ancestor , tuple ( props ) )