def crosslink_master_ids(reaction_masters):
    """
    Map master reaction IDs to reaction IDs.

    EC numbers are mapped to undirected Rhea master reactions. Rhea rd
    files map directed Rhea reaction to undirected master reactions.
    Mapping master reactions to directed reactions allows mapping enzyme
    EC numbers to directed reaction Rhea IDs.

    Parameters
    ----------
    reaction_masters : dict
        Mapping from reaction IDs to master IDs.

    Returns
    -------
    dict
        Mapping from master IDs to reaction IDs.

    """
    master_reactions = {}
    for rhea, master in reaction_masters.items():
        master_reactions.setdefault(master, []).append(rhea)
    return master_reactions