def is_last_attempt(request):
    """
    Return `True` if the request is on its last attempt, meaning that
    the `TransactionTween` will not invoke the handler again, regardless
    of what happens during this attempt.
    """
    environ = request.environ
    attempt = environ.get('retry.attempt')
    attempts = environ.get('retry.attempts')
    return (True if attempt is None or attempts is None else attempt + 1 ==
        attempts)
