def reverse_list_valued_dict(dict_obj):
    """Reverse a list-valued dict, so each element in a list maps to its key.

    Parameters
    ----------
    dict_obj : dict
        A dict where each key maps to a list of unique values. Values are
        assumed to be unique across the entire dict, on not just per-list.

    Returns
    -------
    dict
        A dict where each element in a value list of the input dict maps to
        the key that mapped to the list it belongs to.

    Example
    -------
    >>> dicti = {'a': [1, 2], 'b': [3, 4]}
    >>> reverse_list_valued_dict(dicti)
    {1: 'a', 2: 'a', 3: 'b', 4: 'b'}
    """
    new_dict = {}
    for key in dict_obj:
        for element in dict_obj[key]:
            new_dict[element] = key
    return new_dict
