def levenshtein_distance(a, b):
	"""Return the Levenshtein distance between two strings."""
	# Taken from Rosetta Code
	# <http://rosettacode.org/wiki/Levenshtein_distance#Python>
	if len(a) > len(b):
		a, b = b, a
	ds = list(range(len(a) + 1))
	for ib, cb in enumerate(b):
		ds2 = [ib+1]
		for ia, ca in enumerate(a):
			if ca == cb:
				ds2.append(ds[ia])
			else:
				ds2.append(min((ds[ia], ds[ia+1], ds2[-1])) + 1)
		ds = ds2
	return ds[-1]