'Indicate whether request should be retried.
Only returns C{True} if method is idempotent, no response was
received, the reason for the failed request was not due to
user-requested cancellation, and no body was sent. The latter
requirement may be relaxed in the future, and PUT added to approved
method list.
@param method: The method of the request.
@type method: L{bytes}'

def _shouldRetry(self, method, exception, bodyProducer):

    if (method not in ('GET', 'HEAD', 'OPTIONS', 'DELETE', 'TRACE')):
        return False
    if (not isinstance(exception, (RequestNotSent, RequestTransmissionFailed, ResponseNeverReceived))):
        return False
    if isinstance(exception, _WrapperException):
        for aFailure in exception.reasons:
            if aFailure.check(defer.CancelledError):
                return False
    if (bodyProducer is not None):
        return False
    return True
