def topo_sort_dfs(node, visited, topo_order):
    'Post-order DFS'
    if (node in visited):
        return
    visited.add(node)
    for n in node.inputs:
        topo_sort_dfs(n, visited, topo_order)
    topo_order.append(node)
Post-order DFS
def topo_sort_dfs(node, visited, topo_order):
    
    if (node in visited):
        return
    visited.add(node)
    for n in node.inputs:
        topo_sort_dfs(n, visited, topo_order)
    topo_order.append(node)