'Cancel this L{Deferred}.
If the L{Deferred} has not yet had its C{errback} or C{callback} method
invoked, call the canceller function provided to the constructor. If
that function does not invoke C{callback} or C{errback}, or if no
canceller function was provided, errback with L{CancelledError}.
If this L{Deferred} is waiting on another L{Deferred}, forward the
cancellation to the other L{Deferred}.'

def cancel(self):

    if (not self.called):
        canceller = self._canceller
        if canceller:
            canceller(self)
        else:
            self._suppressAlreadyCalled = True
        if (not self.called):
            self.errback(failure.Failure(CancelledError()))
    elif isinstance(self.result, Deferred):
        self.result.cancel()
