def handleCancel(result):
        """
        Propagate the cancellation of an C{@}L{inlineCallbacks} to the
        L{Deferred} it is waiting on.

        @param result: An L{_InternalInlineCallbacksCancelledError} from
            C{cancel()}.
        @return: A new L{Deferred} that the C{@}L{inlineCallback} generator
            can callback or errback through.
        """
        result.trap(_InternalInlineCallbacksCancelledError)
        status.deferred = Deferred(cancel)
        # We would only end up here if the inlineCallback is waiting on
        # another Deferred.  It needs to be cancelled.
        awaited = status.waitingOn
        awaited.cancel()
        return status.deferred

        Propagate the cancellation of an C{@}L{inlineCallbacks} to the
        L{Deferred} it is waiting on.

        @param result: An L{_InternalInlineCallbacksCancelledError} from
            C{cancel()}.
        @return: A new L{Deferred} that the C{@}L{inlineCallback} generator
            can callback or errback through.
        
stackoverflow/venv/lib/python3.6/site-packages/twisted/internet/defer.py