def sort_nodes(graph, m, desc=True):
    sorted_keys = sorted(m.iteritems(), key=lambda (k, v): (v, k), reverse=desc)
    nodes = [graph.node[k] for k, _ in sorted_keys]
    return nodes
Returns a list of nodes sorted according to the given mapping.
dataset/ETHPy150Open croach/pydata2013/govtrack.py/sort_nodes