invert_multi_dict#

invert_multi_dict(d)#

Invert a dictionary, grouping keys by shared values.

Parameters:

d (dict[K, V]) – Input mapping (values need not be unique).

Returns:

Mapping from value to set of keys that mapped to it.

Return type:

dict[V, set[K]]