def measure_distance(cell1, cell2):
	""" This function maps distances in a cartesian plane of size 10X10 to a
	torus of the same size and then measures the Euclidean distance on
	the torus.
	"""

	x1, y1 = cell1.location
	x2, y2 = cell2.location
	x_dist = abs(x1-x2)
	y_dist = abs(y1-y2)

	if x_dist > 5:
		x_dist = 10-x_dist
	if y_dist > 5:
		y_dist = 10-y_dist

	return (x_dist**2 + y_dist**2)**.5