code: def add_future(self, future, callback):
          
          assert is_future(future)
          callback = stack_context.wrap(callback)
          future.add_done_callback(
              lambda future: self.add_callback(callback, future))
docs: Schedules a callback on the ``IOLoop`` when the given
          `.Future` is finished.
  
          The callback is invoked with one argument, the
          `.Future`.