code: def _round_half_hour(record):
      
      k = record.datetime + timedelta(minutes=-(record.datetime.minute % 30))
      return datetime(k.year, k.month, k.day, k.hour, k.minute, 0)
docs: Round a time DOWN to half nearest half-hour.