Return ``True`` if the exception is recognized as :term:`retryable error`.

    This will return ``False`` if the request is on its last attempt.
    This will return ``False`` if ``pyramid_retry`` is inactive for the
    request.

def is_error_retryable(request, exc):
    """
    Return ``True`` if the exception is recognized as :term:`retryable error`.

    This will return ``False`` if the request is on its last attempt.
    This will return ``False`` if ``pyramid_retry`` is inactive for the
    request.

    """
    if is_last_attempt(request):
        return False

    return (
        isinstance(exc, RetryableException)
        or IRetryableError.providedBy(exc)
    )