Adds a company_name quarter event to the calendar. dt should be a date object. Returns True if the event was added.

def add_company_quarter(self, company_name, quarter_name, dt, calendar_id = 'notices'):
        '''Adds a company_name quarter event to the calendar. dt should be a date object. Returns True if the event was added.'''

        assert(calendar_id in self.configured_calendar_ids.keys())
        calendarId = self.configured_calendar_ids[calendar_id]

        quarter_name = quarter_name.title()
        quarter_numbers = {
            'Spring' : 1,
            'Summer' : 2,
            'Fall' : 3,
            'Winter' : 4
        }
        assert(quarter_name in quarter_numbers.keys())

        start_time = datetime(year=dt.year, month=dt.month, day=dt.day, hour=0, minute=0, second=0, tzinfo=self.timezone) + timedelta(days = -1)
        end_time = start_time + timedelta(days = 3, seconds = -1)
        summary = '%s %s Quarter begins' % (company_name, quarter_name)

        # Do not add the quarter multiple times
        events = self.get_events(start_time.isoformat(), end_time.isoformat(), ignore_cancelled = True)
        for event in events:
            if event.summary.find(summary) != -1:
                return False

        event_body = {
            'summary' : summary,
            'description' : summary,
            'start' : {'date' : dt.isoformat(), 'timeZone' : self.timezone_string},
            'end' : {'date' : dt.isoformat(), 'timeZone' : self.timezone_string},
            'status' : 'confirmed',
            'gadget' : {
                'display' : 'icon',
                'iconLink' : 'https://guybrush.ucsf.edu/images/Q%d_32.png' % quarter_numbers[quarter_name],
                'title' : summary,
            },
            'extendedProperties' : {
                'shared' : {
                    'event_type' : '%s quarter' % company_name,
                    'quarter_name' : quarter_name
                }
            }
        }
        colortext.warning('\n%s\n' % pprint.pformat(event_body))
        created_event = self.service.events().insert(calendarId = self.configured_calendar_ids[calendar_id], body = event_body).execute()
        return True