def _reverse_map(dictionary) -> dict:
    """
    Inverts a map of single or iterable value types.

    { a: b, c: d, } will become { b: a, d: c, }
    { a: [b, c], d: [e, f], } will become { b: a, c: a, e: d, f: d, }

    etc...
    """
    result = {}
    for k in dictionary.keys():
        v = dictionary[k]
        if isinstance(v, (list, set, frozenset, tuple)):
            for _v in v:
                result[_v] = k
        else:
            result[v] = k
    return result