def invert_map(map):
	"""
	Given a dictionary, return another dictionary with keys and values
	switched. If any of the values resolve to the same key, raises
	a ValueError.

	>>> numbers = dict(a=1, b=2, c=3)
	>>> letters = invert_map(numbers)
	>>> letters[1]
	'a'
	>>> numbers['d'] = 3
	>>> invert_map(numbers)
	Traceback (most recent call last):
	...
	ValueError: Key conflict in inverted mapping
	"""
	res = dict((v, k) for k, v in map.items())
	if not len(res) == len(map):
		raise ValueError('Key conflict in inverted mapping')
	return res
Given a dictionary, return another dictionary with keys and values
	switched. If any of the values resolve to the same key, raises
	a ValueError.

	>>> numbers = dict(a=1, b=2, c=3)
	>>> letters = invert_map(numbers)
	>>> letters[1]
	'a'
	>>> numbers['d'] = 3
	>>> invert_map(numbers)
	Traceback (most recent call last):
	...
	ValueError: Key conflict in inverted mapping