code: def _flush_wait(flush_future, write_future):
      
      if write_future.done():
          if not _pending_measurements():
              flush_future.set_result(True)
              return
          else:
              write_future = _write_measurements()
      ioloop.IOLoop.current().add_timeout(
          ioloop.IOLoop.current().time() + 0.25,
          _flush_wait, flush_future, write_future)
docs: Pause briefly allowing any pending metric writes to complete before
      shutting down.
  
      :param tornado.concurrent.Future flush_future: The future to resolve
          when the shutdown is complete.
      :param tornado.concurrent.Future write_future: The future that is for the
          current batch write operation.