Invert a dictionary by swapping its keys and values [1]