'Fire the deferred to indicate the task completed with a failure.
@type err: L{Failure <failure.Failure>}
@param err: The error that occurred.'

def fail(self, err=None):

    if (err is None):
        err = failure.Failure()
    if (self.openCall is not None):
        self.openCall.cancel()
    self.defer.errback(err)
    self.defer = None
