import colorsys


def generate_colour(num, count, rotate):
	"""Create an RGB colour value from an HSV colour wheel.
	num - index from the rainbow
	count - number of items in the rainbow
	rotate - number between 0 and 1 to rotate the rainbow from its
		usual red first, violet last.
	"""
	h = num / count
	h = h + rotate
	# Fold back into 0..1
	h = h - int(h)
	s = 1
	v = 1
	r, g, b = colorsys.hsv_to_rgb(h, s, v)
	return (int(r * 255), int(g * 255), int(b * 255))