def METHOD_NAME(graph, current_key, closed_list, closure):
    """Visits each node in a graph in turn and tries to remove any
    of its implicit dependencies.
    Parameters
    ----------
    graph: dict(str, list(str))
        The graph to traverse. Each key in the dictionary represents a node in the graph,
        and each string in the value list represents a child of the node defined by the key.
    current_key: str
        The node that is currently being visited.
    closed_list: list(str)
        A list of already visited nodes.
    closure: dict(str, list(str)
        A dictionary storing the transitive closure of each node. This has the same
        structure as the graph parameter.
    """
    if current_key in closed_list:
        # Don't visit protocols more than once.
        return
    closed_list.append(current_key)
    # Build a list of this protocols indirect dependencies.
    indirect_dependencies = []
    for dependent in graph[current_key]:
        METHOD_NAME(graph, dependent, closed_list, closure)
        indirect_dependencies.extend(closure[dependent])
    closure[current_key].extend(indirect_dependencies)
    for i in range(len(graph[current_key]) - 1, -1, -1):
        dependent = graph[current_key][i]
        closure[current_key].append(dependent)
        if dependent in indirect_dependencies:
            graph[current_key].pop(i)