def get_events(self, time_period, include_archived=False) -> Optional[int]:
        """Get the number of events that have occurred on this Monitor.

        Specifically only gets events that have occurred within the TimePeriod
        provided.
        """
        date_filter = '1%20{}'.format(time_period.period)
        if time_period == TimePeriod.ALL:
            # The consoleEvents API uses DATE_SUB, so give it
            # something large
            date_filter = '100%20year'

        archived_filter = '/Archived=:0'
        if include_archived:
            archived_filter = ''

        event = self._client.get_state(
            'api/events/consoleEvents/{}{}.json'.format(
                date_filter,
                archived_filter
            )
        )

        try:
            events_by_monitor = event['results']
            if isinstance(events_by_monitor, list):
                return 0
            return events_by_monitor.get(str(self._monitor_id), 0)
        except (TypeError, KeyError, AttributeError):
            return None
Get the number of events that have occurred on this Monitor.

        Specifically only gets events that have occurred within the TimePeriod
        provided.