def onResult(success, result):
    if success:
        reactor.callFromThread(d.callback, result)
    else:
        reactor.callFromThread(d.errback, result)
def onResult(success, result):
    if success:
        reactor.callFromThread(d.callback, result)
    else:
        reactor.callFromThread(d.errback, result)