code: def add_callbacks(self, future, callback, errback):
          
          assert future is not None
          if callback is None:
              assert errback is not None
              future.addErrback(errback)
          else:
              # Twisted allows errback to be None here
              future.addCallbacks(callback, errback)
          return future
docs: callback or errback may be None, but at least one must be
          non-None.