def calculate_offset(at_time):
    """
    Helper function takes a datetime and calculates the offset assuming
    a 96 bit string for every quarter hour of a 24 hour day.

    :param at_time: Datetime for calculating the offset
    :rtype: int
    """
    offset = at_time.hour * 4
    #if offset is 0:
    #    offset = 1
    minute = at_time.minute
    if minute < 15:
        offset += 1 
    if minute > 14 and minute < 30:
        offset += 2
    elif minute > 29 and minute < 45:
        offset += 3
    elif minute > 44:
        offset += 4
    return offset