def get_electrodes_mapping(electrodes):
    """
    Create a mapping from the probe and electrode id to the row number of the electrodes
    table. This is used in the construction of the DynamicTableRegion that indicates what rows of the electrodes
    table correspond to the data in an ElectricalSeries.

    Parameters
    ----------
    electrodes: hdmf.common.table.DynamicTable

    Returns
    -------
    dict

    """
    return {
        (electrodes["group"][idx].device.name, electrodes["id_in_probe"][idx],): idx
        for idx in range(len(electrodes))
    }