def round_time(time, round_to):
    """roundTo is the number of minutes to round to"""
rounded = time + datetime.timedelta(minutes=round_to / 2.0)
rounded -= datetime.timedelta(minutes=rounded.minute % round_to, seconds=
    rounded.second, microseconds=rounded.microsecond)
return rounded
How do I round datetime column to nearest quarter hour