def make_tree_defs(mod_files_list):
 tree_defs = {}
 for (mod, files) in mod_files_list:
  node = (tree_defs, ())
  for prefix in mod.split('.'):
   node = node[0].setdefault(prefix, [{}, []])
  node[1] += files
 return tree_defs

def make_tree_defs ( mod_files_list ) : tree_defs = { } for ( mod , files ) in mod_files_list : node = ( tree_defs , ( ) ) for prefix in mod . split ( '.' ) : node = node [ 0 ] . setdefault ( prefix , [ { } , [ ] ] ) node [ 1 ] += files return tree_defs
get a list of 2-uple .