def nested():
    return defaultdict(nested)

def build_tree(data):
    tree = nested()
for name, path in list(data.items()):
    d = tree
for p in path:
    d = d[p]
d['value'] = name
return tree
Create a hierarchy from a dictionary of lists