def describe_tree(repo, tree, indent=2, lvl=0):
    output = []
    if isinstance(tree, pygit2.Oid):
        tree = repo[tree]
    for e in tree:
        i = ' ' * indent * lvl
        is_tree = repo[e.oid].type == pygit2.GIT_OBJ_TREE
        slash = is_tree and '/' or ''
        output.append('{}{}{}'.format(i, e.name, slash))
        if is_tree:
            sub_items = describe_tree(repo, e.oid, indent, lvl + 1)
            output.extend(sub_items)
    if lvl == 0:
        return '\n'.join(output)
    return output
Returns a string representation of the given tree, recursively.
dataset/ETHPy150Open bendavis78/python-gitmodel/gitmodel/utils/path.py/describe_tree