def METHOD_NAME(self, request, *args, **kwargs):
    self.user_enrollment = get_object_or_404(
        UserEnrollment,
        pk=kwargs["pk"]
    )
    if not self.user_enrollment.enrollment_secret.is_valid():
        # should not happen
        raise SuspiciousOperation
    return super().METHOD_NAME(request, *args, **kwargs)