def check_permitted_value(permitted_dict, provided_key):
    """Get a key/value mapping from a dict of permitted value.

    If the key is not found in the dictionary, raise a KeyError with a more
    descriptive message of the error.

    Parameters
    ----------
    permitted_dict : dict
        A dictionary of valid key/value mappings

    provided_key : str, int
        The key provided by the user
    """
    try:
        return permitted_dict[provided_key]
    except KeyError:
        raise KeyError("%r is not a valid key. Must be one of %s"
                       % (provided_key, str(list(permitted_dict.keys()))))