def add_node(node, parent=None):
    label_tuple = tuple(node['label'])
    labels_seen.add(label_tuple)
    node['parent'] = parent
    to_save.append(node)
    for child in node['children']:
        add_node(child, parent=node)
def add_node(node, parent=None):
    label_tuple = tuple(node['label'])
    labels_seen.add(label_tuple)
    node['parent'] = parent
    to_save.append(node)
    for child in node['children']:
        add_node(child, parent=node)