def previous_calendar_week(t=None):
    """
    To education monitoring, a week runs between Thursdays,
    Thursday marks the beginning of a new week of data submission
    Data for a new week is accepted until Wednesday evening of the following week
    """
    d = t or datetime.datetime.now()
    if not d.weekday() == 3:
        # last Thursday == next Thursday minus 7 days.
        last_thursday = d + (datetime.timedelta((3-d.weekday())%7) - (datetime.timedelta(days=7)))
    else:
        last_thursday = d
    end_date = last_thursday + datetime.timedelta(days=6)
    return (last_thursday.date(), end_date)