def depends_directly_on(dependencies):
    """Takes a dependency dictionary d and "inverts" it so that d[section] will return
    the other sections which depend directly on that section"""

    depends_on = {s: set() for s in dependencies.keys()}
    for s, dependencies in dependencies.items():
        for dep in dependencies:
            depends_on[dep].add(s)
    return depends_on