def prom_name2abs_name(system, prom_name, type_):
    """
    Map the given promoted name to the absolute name.

    This is only valid when the name is unique; otherwise, a KeyError is thrown.

    Parameters
    ----------
    system : <System>
        System to which prom_name is relative.
    prom_name : str
        Promoted variable name in the owning system's namespace.
    type_ : str
        Either 'input' or 'output'.

    Returns
    -------
    str or None
        Absolute variable name or None if prom_name is invalid.
    """
    prom2abs_lists = system._var_allprocs_prom2abs_list[type_]
    if prom_name in prom2abs_lists:
        abs_list = prom2abs_lists[prom_name]
        if len(abs_list) == 1:
            return abs_list[0]
        else:
            src_name = system._conn_global_abs_in2out.get(abs_list[0])
            if src_name and src_name in system._var_abs2prom['output']:
                src_name = system._var_abs2prom['output'][src_name]
            if src_name:
                raise RuntimeError(
                    'The promoted name {} is invalid because it refers to multiple inputs: [{}]. Access the value from the connected output variable {} instead.'
                    .format(prom_name, ' ,'.join(abs_list), src_name))
            else:
                raise RuntimeError(
                    'The promoted name {} is invalid because it refers to multiple inputs: [{}] that are not connected to an output variable.'
                    .format(prom_name, ', '.join(abs_list)))
    else:
        return None
