def do_get_threaded_comment_tree(parser, token):
    error_string = "%r tag must be of format {%% get_threaded_comment_tree for OBJECT [TREE_ROOT] as CONTEXT_VARIABLE %%}" % token.contents.split()[0]
    try:
        split = token.split_contents()
    except ValueError:
        raise template.TemplateSyntaxError(error_string)
    if len(split) == 5:
        return CommentTreeNode(split[2], split[4], split[3])
    elif len(split) == 6:
        return CommentTreeNode(split[2], split[5], split[3])
    else:
        raise template.TemplateSyntaxError(error_string)
Gets a tree (list of objects ordered by preorder tree traversal, and with an
dataset/ETHPy150Open caseywstark/colab/colab/apps/threadedcomments/templatetags/threadedcommentstags.py/do_get_threaded_comment_tree