def Comparator(p1, p2):
	"""Used to sort lists of (name, value) tuples."""
	if p1[1] == p2[1]:
		if p1[0] == p2[0]:
			return 0
		elif p1[0] < p2[0]:
			return -1
		else:
			return 1
	elif p1[1] < p2[1]:
		return -1
	else:
		return 1;