def serialize(pre, adjacency_map):
    return {'label': pre.label_string.split('-'), 'text': pre.text, 'node_type': pre.node_type, 'children': [serialize(child, adjacency_map) for child in adjacency_map.get(pre.id, [])]}
def serialize(pre, adjacency_map):
    return {'label': pre.label_string.split('-'), 'text': pre.text, 'node_type': pre.node_type, 'children': [serialize(child, adjacency_map) for child in adjacency_map.get(pre.id, [])]}