def _index_list(key_or_list, direction=None):
 if (direction is not None):
  return [(key_or_list, direction)]
 else:
  if isinstance(key_or_list, string_type):
   return [(key_or_list, ASCENDING)]
  elif (not isinstance(key_or_list, (list, tuple))):
   raise TypeError('if no direction is specified, key_or_list must be an instance of list')
  return key_or_list

def _index_list ( key_or_list , direction = None ) : if ( direction is not None ) : return [ ( key_or_list , direction ) ] else : if isinstance ( key_or_list , string_type ) : return [ ( key_or_list , ASCENDING ) ] elif ( not isinstance ( key_or_list , ( list , tuple ) ) ) : raise TypeError ( 'if no direction is specified, key_or_list must be an instance of list' ) return key_or_list
helper to generate a list of pairs .