code: def _get_events(self):
          
          self.last_update = datetime.datetime.now()
          time_min = datetime.datetime.utcnow()
          time_max = time_min + datetime.timedelta(hours=self.events_within_hours)
          events = []
  
          try:
              eventsResult = (
                  self.service.events()
                  .list(
                      calendarId="primary",
                      timeMax=time_max.isoformat() + "Z",  # 'Z' indicates UTC time
                      timeMin=time_min.isoformat() + "Z",  # 'Z' indicates UTC time
                      singleEvents=True,
                      orderBy="startTime",
                  )
                  .execute(num_retries=5)
              )
          except Exception:
              return self.events or events
          else:
              for event in eventsResult.get("items", []):
                  # filter out events that we did not accept (default)
                  # unless we organized them with no attendees
                  i_organized = event.get("organizer", {}).get("self", False)
                  has_attendees = event.get("attendees", [])
                  for attendee in event.get("attendees", []):
                      if attendee.get("self") is True:
                          if attendee["responseStatus"] in self.response:
                              break
                  else:
                      # we did not organize the event or we did not accept it
                      if not i_organized or has_attendees:
                          continue
  
                  # strip and lower case output if needed
                  for key in ["description", "location", "summary"]:
                      event[key] = event.get(key, "").strip()
                      if self.force_lowercase is True:
                          event[key] = event[key].lower()
  
                  # ignore all day events if configured
                  if event["start"].get("date") is not None:
                      if self.ignore_all_day_events:
                          continue
  
                  # filter out blacklisted event names
                  if event["summary"] is not None:
                      if event["summary"].lower() in map(
                          lambda e: e.lower(), self.blacklist_events
                      ):
                          continue
  
                  events.append(event)
  
          return events[: self.num_events]
docs: Fetches events from the calendar into a list.
  
          Returns: The list of events.