def _set_result_unless_cancelled(fut: Future, result: Any) -> None:
    'Set the result only if the Future was not cancelled.'
    if fut.cancelled():
        return
    fut.set_result(result)
Set the result only if the Future was not cancelled.
def _set_result_unless_cancelled(fut: Future, result: Any) -> None:
    
    if fut.cancelled():
        return
    fut.set_result(result)