def tree_pop_fields(root, fields):
    """deletes given fields (as iterable of keys) from root and all its children (recursively)
    returnes updated root """
    for f in fields:
        root.pop(f)
    if root['is_leaf']: return root
    for i in range(len(root['children'])):
        root['children'][i]['child'] = tree_pop_fields(root['children'][i]['child'], fields)
    return root