human
Complete this python program:
def dfs(graph, root, visitor):
assistant
#Here is the Python code you requested.

    """DFS over a graph.
    Start with node \root\, calling \visitor\ for every visited node.
    """
    visited = set()
    def dfs_walk(node):
        visited.add(node)
        visitor(node)
        for succ in graph.successors(node):
            if (not (succ in visited)):
                dfs_walk(succ)
    dfs_walk(root)