def _categories_level(keys):
 res = []
 for i in zip(*keys):
  tuplefied = _tuplify(i)
  res.append(list(OrderedDict([(j, None) for j in tuplefied])))
 return res

def _categories_level ( keys ) : res = [ ] for i in zip ( * keys ) : tuplefied = _tuplify ( i ) res . append ( list ( OrderedDict ( [ ( j , None ) for j in tuplefied ] ) ) ) return res
use the ordered dict to implement a simple ordered set return each level of each category [[key_1_level_1 .