'Sets the return value of work associated with the future.
Should only be used by Executor implementations and unit tests.'

def set_result(self, result):

    with self._condition:
        self._result = result
        self._state = FINISHED
        for waiter in self._waiters:
            waiter.add_result(self)
        self._condition.notify_all()
    self._invoke_callbacks()
