def get_children(id):
ids=[]
for p in tree:
if p['pid'] == id:
ids.append(p['id'])
for c in get_children(p['id']):
ids.append(c)
return ids
def get_children(id):
ids=[]
for p in tree:
if p['pid'] == id:
ids.append(p['id'])
for c in get_children(p['id']):
ids.append(c)
return ids