def reverse_post_order_sort_nodes(graph, nodes=None):
        post_order = networkx.dfs_postorder_nodes(graph)
        if nodes is None:
            return reversed(list(post_order))
        addrs_to_index = {}
        for i, n in enumerate(post_order):
            addrs_to_index[n.addr] = i
        return sorted(nodes, key=lambda n: addrs_to_index[n.addr], reverse=True)