def dict_of_relay_branches(relays, branches):
    """
    Create dictionaries of the branch keys from the
    relay elements
    """
    relay_branches = {k: list() for k in relays.keys()}

    for branch_name, branch in branches.items():
        branch_relay_mappings = branch['relay']
        for r in branch_relay_mappings:
            relay_branches[r].append(branch_name)

    return relay_branches