def add_node_id(root,id):
    """
    Add id to root, e.g.,root={'name': 'Module', 'children': [{'name': 'Import', 'children': [{'name': 'sss'}]}]}
    this function will change root to {'name': 'Module', 'id':1,'children': [{'name': 'Import', 'id':2,'children': [{'name': 'sss','id':3}]}]}
    """
    if isinstance(root,dict):
        root['id']=id
        id+=1
        if 'children' in root:
            children=root['children']
            for i in children:
                id=add_node_id(i,id)
        return id