code: def _flush(self, buffer):
          
          if not self.state.should_try():
              logger.error("dropping flushed data due to transport failure back-off")
          else:
              fileobj = buffer.fileobj  # get a reference to the fileobj before closing the gzip file
              buffer.close()
  
              # StringIO on Python 2 does not have getbuffer, so we need to fall back to getvalue
              data = fileobj.getbuffer() if hasattr(fileobj, "getbuffer") else fileobj.getvalue()
              try:
                  self.send(data)
                  self.handle_transport_success()
              except Exception as e:
                  self.handle_transport_fail(e)
docs: Flush the queue. This method should only be called from the event processing queue
          :param sync: if true, flushes the queue synchronously in the current thread
          :return: None