def get_location_subnodes(location):
    subnodes = location.nx_descendants(include_self=True)
    center_pks = [node['id'] for node in subnodes if node['type'] == 'RC']
    state_nodes = [node for node in subnodes if node['type'] == 'State']
    location_tree = {}
    for node in state_nodes:
        location_tree[node['name']] = [n['name'] for n in Location._subnodes(node, 'LGA')]

    return center_pks, location_tree
def subnodes(node, type=None):
    return Location._subnodes(node, type)