def METHOD_NAME(self):
    user = self.request.user
    # user.has_perms hasn't been called yet so django-guardian
    # hasn't replaced the AnonymousUser with an actual user object
    if user.is_anonymous:
        return redirect_to_login(
            self.request.get_full_path(), settings.LOGIN_URL, "next"
        )
    if hasattr(self, "get_object"):
        obj = self.get_object()
    else:
        obj = None
    perms = self.get_required_permissions()
    if user.has_perms(perms, obj):
        return None
    else:
        raise PermissionDenied