def _get_events(self):
self.last_update = datetime.datetime.now()<EOL>time_min = datetime.datetime.utcnow()<EOL>time_max = time_min + datetime.timedelta(hours=self.events_within_hours)<EOL>events = []<EOL>try:<EOL><INDENT>eventsResult = (<EOL>self.service.events()<EOL>.list(<EOL>calendarId="<STR_LIT>",<EOL>timeMax=time_max.isoformat() + "<STR_LIT>",  <EOL>timeMin=time_min.isoformat() + "<STR_LIT>",  <EOL>singleEvents=True,<EOL>orderBy="<STR_LIT>",<EOL>)<EOL>.execute(num_retries=<NUM_LIT:5>)<EOL>)<EOL><DEDENT>except Exception:<EOL><INDENT>return self.events or events<EOL><DEDENT>else:<EOL><INDENT>for event in eventsResult.get("<STR_LIT>", []):<EOL><INDENT>i_organized = event.get("<STR_LIT>", {}).get("<STR_LIT>", False)<EOL>has_attendees = event.get("<STR_LIT>", [])<EOL>for attendee in event.get("<STR_LIT>", []):<EOL><INDENT>if attendee.get("<STR_LIT>") is True:<EOL><INDENT>if attendee["<STR_LIT>"] in self.response:<EOL><INDENT>break<EOL><DEDENT><DEDENT><DEDENT>else:<EOL><INDENT>if not i_organized or has_attendees:<EOL><INDENT>continue<EOL><DEDENT><DEDENT>for key in ["<STR_LIT:description>", "<STR_LIT:location>", "<STR_LIT>"]:<EOL><INDENT>event[key] = event.get(key, "<STR_LIT>").strip()<EOL>if self.force_lowercase is True:<EOL><INDENT>event[key] = event[key].lower()<EOL><DEDENT><DEDENT>if event["<STR_LIT:start>"].get("<STR_LIT:date>") is not None:<EOL><INDENT>if self.ignore_all_day_events:<EOL><INDENT>continue<EOL><DEDENT><DEDENT>if event["<STR_LIT>"] is not None:<EOL><INDENT>if event["<STR_LIT>"].lower() in map(<EOL>lambda e: e.lower(), self.blacklist_events<EOL>):<EOL><INDENT>continue<EOL><DEDENT><DEDENT>events.append(event)<EOL><DEDENT><DEDENT>return events[: self.num_events]<EOL>
Fetches events from the calendar into a list.

Returns: The list of events.