def callback(future): # print(("callback", future, future.result())) e = future.exception() if e: # print(("reject", e)) promise.reject(e) else: promise.fulfill(future.result())