def METHOD_NAME(request, *args, **kwargs):
    decision = condition(request, *args, **kwargs)
    if isinstance(decision, AccessDenied) and decision.response:
        return decision.response
    if decision:
        return view_func(request, *args, **kwargs)
    if template is not None:
        return TemplateResponse(request, template)
    elif (
        not request.user.is_authenticated
        and not is_ajax(request)
        and login_redirect
    ):
        return redirect_to_login(request.path)
    else:
        raise PermissionDenied