code: def _get_sub_kernel(f):
      """
      Takes the "function" given to generic_filter and returns the "sub-kernel"
      that will be called, one of RawKernel or ReductionKernel.
  
      This supports:
       * cupy.RawKernel
         no checks are possible
       * cupy.ReductionKernel
         checks that there is a single input and output
      """
      if isinstance(f, cupy.RawKernel):
          # We will assume that it has the correct API
          return f
      elif isinstance(f, cupy.ReductionKernel):
          if f.nin != 1 or f.nout != 1:
              raise TypeError(
                  "ReductionKernel must have 1 input and output"
              )
          return f
      elif isinstance(f, cupy.ElementwiseKernel):
          # special error message for ElementwiseKernels
          raise TypeError(
              "only ReductionKernel allowed (not ElementwiseKernel)"
          )
      else:
          raise TypeError("bad function type")
  
file_path: cupy/cupyx/scipy/ndimage/_filters_generic.py
imports: import cupy
  from cupy_backends.cuda.api import runtime
  from cupy import _util
  from cupyx.scipy.ndimage import _filters_core
label_desc: Use image node_id 1 for calling a global function with example usage: _get_sub_kernel(f) and returns: f, f