<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _InsertEvent(self, event, force_flush=False):
 """Inserts an event. Events are buffered in the form of documents and inserted to Elasticsearch when either forced to flush or when the flush interval (threshold) has been reached. Args: event (EventObject):
 event. force_flush (bool):
 True if buffered event documents should be inserted into Elasticsearch. """

    if event:
      event_document = {'index': {
          '_index': self._index_name, '_type': self._document_type}}
      event_values = self._GetSanitizedEventValues(event)

      self._event_documents.append(event_document)
      self._event_documents.append(event_values)
      self._number_of_buffered_events += 1

    if force_flush or self._number_of_buffered_events > self._flush_interval:
      self._FlushEvents()