def normalize_on_minute(dtstamp, minute):
	"""
	Change a datetime stamp to be rounded down to the nearest interval of `minute`.
	This also truncates off the seconds and microseconds parameters by setting them to 0.

	>>> normalize_on_minute(datetime(2012, 3, 19, 15, 9, 12, 41), 15)
	datetime.datetime(2012, 3, 19, 15, 0)
	>>> normalize_on_minute(datetime(2013,3, 19, 15, 24, 20, 19), 20)
	datetime.datetime(2013, 3, 19, 15, 20)
	"""

	tsmin = dtstamp.minute
	rounded_tsmin = tsmin - (tsmin % minute)
	return dtstamp.replace(microsecond=0, second=0, minute=rounded_tsmin)