def get_events(self, time_period, include_archived=False) -> Optional[int]:
date_filter = '<STR_LIT>'.format(time_period.period)<EOL>if time_period == TimePeriod.ALL:<EOL><INDENT>date_filter = '<STR_LIT>'<EOL><DEDENT>archived_filter = '<STR_LIT>'<EOL>if include_archived:<EOL><INDENT>archived_filter = '<STR_LIT>'<EOL><DEDENT>event = self._client.get_state(<EOL>'<STR_LIT>'.format(<EOL>date_filter,<EOL>archived_filter<EOL>)<EOL>)<EOL>try:<EOL><INDENT>events_by_monitor = event['<STR_LIT>']<EOL>if isinstance(events_by_monitor, list):<EOL><INDENT>return <NUM_LIT:0><EOL><DEDENT>return events_by_monitor.get(str(self._monitor_id), <NUM_LIT:0>)<EOL><DEDENT>except (TypeError, KeyError, AttributeError):<EOL><INDENT>return None<EOL><DEDENT>
Get the number of events that have occurred on this Monitor.

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