code: def flush(self, timeout=None, callback=None):
          
          if self.transport is not None:
              if timeout is None:
                  timeout = self.options["shutdown_timeout"]
              self.transport.flush(timeout=timeout, callback=callback)
docs: Wait `timeout` seconds for the current events to be sent. If no
          `timeout` is provided, the `shutdown_timeout` option value is used.
  
          The `callback` is invoked with two arguments: the number of pending
          events and the configured timeout.  For instance the default atexit
          integration will use this to render out a message on stderr.