def callback(self, result):
    for cb, eb in self.callbacks:
        if isinstance(result, Failure):
            cb = eb
try:
    result = cb(result)
except:
    result = Failure()
Is Twisted's Deferred the same as a Promise in JavaScript?