Return ``True`` if the request is on its last attempt, meaning that
    ``pyramid_retry`` will not be issuing any new attempts, regardless of
    what happens when executing this request.

    This will return ``True`` if ``pyramid_retry`` is inactive for the
    request.

def is_last_attempt(request):
    """
    Return ``True`` if the request is on its last attempt, meaning that
    ``pyramid_retry`` will not be issuing any new attempts, regardless of
    what happens when executing this request.

    This will return ``True`` if ``pyramid_retry`` is inactive for the
    request.

    """
    environ = request.environ
    attempt = environ.get('retry.attempt')
    attempts = environ.get('retry.attempts')
    if attempt is None or attempts is None:
        return True

    return attempt + 1 == attempts