def classify(rules, record):
	"""
	Classify records according to the rule set rules.

	Return the predicted class for record.

	Input:
		rules - set of rules (Rule objects);
		record - record to classify.
	"""

	prediction = None	# predicted class

	try:
		iterator = iter(rules)	# iterator on rules

		while prediction is None:	# a rule has not yet matched
			prediction = iterator.next().classify(record)
			# classify with the next rule

	except StopIteration:
		pass

	return prediction