return parent
comment_tree = []
for record in comment_set:
    if record['parent_id'] is None:
        comment_tree.append(create_tree(record, comment_set))
Rendering a tree from a closure table SELECT statement?