Given a parent-child comment history, how would you create a tree?
Implement build_comment_tree(history). Each history item is a dictionary with parent_id and comment_id; parent_id is null for a root comment. Return a list of root nodes, where each node has the shape {"id": comment_id, "children": [...]}. Preserve the order in which roots and children first appear. Assume every comment has at most one parent and the relationships form a forest.
def build_comment_tree(history):