class_docstr: An `Op` that checks conditions and raises an exception if they fail.
  
  This `Op` returns its "value" argument if its condition arguments are all
  ``True``; otherwise, it raises a user-specified exception.
class_docstr_tok: ["An","`","Op","`","that","checks","conditions","and","raises","an","exception","if","they","fail",".","This","`","Op","`","returns","its","``","value","''","argument","if","its","condition","arguments","are","all","``","True","``",";","otherwise",",","it","raises","a","user-specified","exception","."]
code: def c_code(self, node, name, inames, onames, props):
      if not isinstance(
          node.inputs[0].type, (DenseTensorType, ScalarType)
      ):
          raise NotImplementedError(
              f"CheckAndRaise c_code not implemented for input type {node.inputs[0].type}"
          )
      value_name, *cond_names = inames
      out_name = onames[0]
      check = []
      fail_code = props["fail"]
      param_struct_name = props["params"]
      msg = self.msg.replace('"', '\\"').replace("\n", "\\n")
  
      for idx, cond_name in enumerate(cond_names):
          if isinstance(node.inputs[0].type, DenseTensorType):
              check.append(
                  f"""
              if(PyObject_IsTrue((PyObject *){cond_name}) == 0) {{
                  PyObject * exc_type = {param_struct_name}->exc_type;
                  Py_INCREF(exc_type);
                  PyErr_SetString(exc_type, "{msg}");
                  Py_XDECREF(exc_type);
                  {indent(fail_code, " " * 4)}
              }}
                      """
              )
          else:
              check.append(
                  f"""
              if({cond_name} == 0) {{
                  PyObject * exc_type = {param_struct_name}->exc_type;
                  Py_INCREF(exc_type);
                  PyErr_SetString(exc_type, "{msg}");
                  Py_XDECREF(exc_type);
                  {indent(fail_code, " " * 4)}
              }}
                      """
              )
  
      check = "\n".join(check)
  
      if isinstance(node.inputs[0].type, DenseTensorType):
          res = f"""
              {check}
              Py_XDECREF({out_name});
              {out_name} = {value_name};
              Py_INCREF({value_name});
              """
      else:
          res = f"""
              {check}
              {out_name} = {value_name};
              """
      return res
  
imports: from textwrap import indent
  import numpy
  from pytensor.gradient import DisconnectedType
  from pytensor.graph.basic import Apply, Variable
  from pytensor.graph.replace import _vectorize_node
  from pytensor.link.c.op import COp
  from pytensor.link.c.params_type import ParamsType
  from pytensor.link.c.type import Generic
  from pytensor.scalar.basic import ScalarType
  from pytensor.tensor.type import DenseTensorType
label_desc: Use image node_id 9 for calling the CheckAndRaise obj's underlying member method code with example usage: obj.c_code(node, name, inames, onames, props) and returns: res