def _MatchPostfix(postfix_props, index_props):
 index_props_rev = reversed(index_props)
 for property_group in reversed(postfix_props):
  index_group_iter = itertools.islice(index_props_rev, len(property_group))
  if isinstance(property_group, (frozenset, set)):
   index_group = set((prop for (prop, _) in index_group_iter))
   if (index_group != property_group):
    return None
  else:
   index_group = list(index_group_iter)
   if (len(index_group) != len(property_group)):
    return None
   for ((index_prop, index_dir), (prop, direction)) in itertools.izip(index_group, reversed(property_group)):
    if ((index_prop != prop) or (direction and (index_dir != direction))):
     return None
 remaining = list(index_props_rev)
 remaining.reverse()
 return remaining

def _MatchPostfix ( postfix_props , index_props ) : index_props_rev = reversed ( index_props ) for property_group in reversed ( postfix_props ) : index_group_iter = itertools . islice ( index_props_rev , len ( property_group ) ) if isinstance ( property_group , ( frozenset , set ) ) : index_group = set ( ( prop for ( prop , _ ) in index_group_iter ) ) if ( index_group != property_group ) : return None else : index_group = list ( index_group_iter ) if ( len ( index_group ) != len ( property_group ) ) : return None for ( ( index_prop , index_dir ) , ( prop , direction ) ) in itertools . izip ( index_group , reversed ( property_group ) ) : if ( ( index_prop != prop ) or ( direction and ( index_dir != direction ) ) ) : return None remaining = list ( index_props_rev ) remaining . reverse ( ) return remaining
matches a postfix constraint with an existing index .