code: def test_CheckAndRaise_basic_c(linker):
      exc_msg = "this is the exception"
      check_and_raise = CheckAndRaise(CustomException, exc_msg)
  
      conds = pt.scalar()
      y = check_and_raise(pt.as_tensor(1), conds)
      y_fn = pytensor.function([conds], y, mode=Mode(linker))
  
      with pytest.raises(CustomException, match=exc_msg):
          y_fn(0)
  
      x = pt.vector()
      y = check_and_raise(x, conds)
      y_fn = pytensor.function(
          [conds, x], y.shape, mode=Mode(linker, OPT_FAST_RUN)
      )
  
      x_val = np.array([1.0], dtype=pytensor.config.floatX)
      assert np.array_equal(y_fn(0, x_val), x_val)
  
      y = check_and_raise(x, pt.as_tensor(0))
      y_grad = pytensor.grad(y.sum(), [x])
      y_fn = pytensor.function(
          [x], y_grad, mode=Mode(linker, OPT_FAST_RUN)
      )
  
      assert np.array_equal(y_fn(x_val), [x_val])
  
imports: import numpy
  import pytest
  import scipy.sparse
  import pytensor
  import pytensor.tensor
  from pytensor.compile.mode import OPT_FAST_RUN, Mode
  from pytensor.graph import vectorize_graph
  from pytensor.graph.basic import Constant, equal_computations
  from pytensor.raise_op import Assert, CheckAndRaise, assert_op
  from pytensor.scalar.basic import ScalarType, float64
  from pytensor.sparse import as_sparse_variable
  from pytensor.tensor.basic import second
  from pytensor.tensor.elemwise import DimShuffle
  from tests import unittest_tools
label_desc: Use image node_id 5 for calling a global function with example usage: test_CheckAndRaise_basic_c(linker) without return types