def get_all_key_combinations(data, flattened_schema):
 schema_prefixes = set([key[:(-1)] for key in flattened_schema])
 combinations = set([()])
 for key in sorted(data.keys(), key=flattened_order_key):
  key_prefix = key[:(-1):2]
  if (key_prefix not in schema_prefixes):
   continue
  if (tuple(tuple(key[:(-3)])) not in combinations):
   continue
  combinations.add(tuple(key[:(-1)]))
 return combinations

def get_all_key_combinations ( data , flattened_schema ) : schema_prefixes = set ( [ key [ : ( - 1 ) ] for key in flattened_schema ] ) combinations = set ( [ ( ) ] ) for key in sorted ( data . keys ( ) , key = flattened_order_key ) : key_prefix = key [ : ( - 1 ) : 2 ] if ( key_prefix not in schema_prefixes ) : continue if ( tuple ( tuple ( key [ : ( - 3 ) ] ) ) not in combinations ) : continue combinations . add ( tuple ( key [ : ( - 1 ) ] ) ) return combinations
compare the schema against the given data and get all valid tuples that match the schema ignoring the last value in the tuple .