def dependants_to_dependencies(graph):
    """Inverts a dependant's graph to yield a dependency graph.

    Notes
    -----
    The graph must be directed and acyclic.

    Parameters
    ----------
    graph: dict(str, list(str))
        The graph to invert. Each key in the dictionary represents a node in the graph, and each
        string in the value list represents a node which depends on the node defined by the key.

    Returns
    -------
    dict(str, list(str))
        The inverted graph. Each key in the dictionary represents a node in the graph, and each
        string in the value list represents a node which the node defined by the key depends on.
    """

    dependencies = {}

    for node in graph:

        if node not in dependencies:
            dependencies[node] = []

        for dependant in graph[node]:

            if dependant not in dependencies:
                dependencies[dependant] = []

            if node not in dependencies[dependant]:
                dependencies[dependant].append(node)

    return dependencies