def unauthenticated_users(func):
    """
    This decorator is used to abstract common unauthentication checking functionality
    out of permission checks. It determines which parameter is the request based on name.
    """
    is_object_permission = "has_object" in func.__name__

    @wraps(func)
    def func_wrapper(*args, **kwargs):
        request = args[0]
        # use second parameter if object permission
        if is_object_permission:
            request = args[1]

        if request.user and request.user.is_authenticated():
            return False

        return func(*args, **kwargs)

    return func_wrapper
dataset/ETHPy150Open dbkaplan/dry-rest-permissions/dry_rest_permissions/generics.py/unauthenticated_users/original