def libtree(lib):
 root = Node({}, {})
 for item in lib.items():
  dest = item.destination(fragment=True)
  parts = util.components(dest)
  _insert(root, parts, item.id)
 return root

def libtree ( lib ) : root = Node ( { } , { } ) for item in lib . items ( ) : dest = item . destination ( fragment = True ) parts = util . components ( dest ) _insert ( root , parts , item . id ) return root
generates a filesystem-like directory tree for the files contained in lib .