code: def scipy_baseline_plane(
      sample, kernel, anchor, border, fill_value, mode
  ):
      from scipy.ndimage import convolve as sp_convolve
  
      ndim = len(sample.shape)
      assert len(kernel.shape) == ndim, f"{kernel.shape}, {ndim}"
      in_dtype = sample.dtype
  
      if isinstance(anchor, int):
          anchor = (anchor,) * ndim
      assert len(anchor) == ndim, f"{anchor}, {ndim}"
      anchor = tuple(
          filt_ext // 2 if anch == -1 else anch
          for anch, filt_ext in zip(anchor, kernel.shape)
      )
      for anch, filt_ext in zip(anchor, kernel.shape):
          assert 0 <= anch < filt_ext
      # there are two ways (and none exact) to center the even filter
      # over the image; scipy does it the other way round
      origin = tuple(
          (filt_ext - 1) // 2 - anch
          for anch, filt_ext in zip(anchor, kernel.shape)
      )
  
      out = sp_convolve(
          np.float32(sample),
          np.float32(np.flip(kernel)),
          mode=border2scipy_border[border],
          origin=origin,
          cval=0 if fill_value is None else fill_value,
      )
  
      if np.issubdtype(in_dtype, np.integer):
          type_info = np.iinfo(in_dtype)
          v_min, v_max = type_info.min, type_info.max
          out = np.clip(out, v_min, v_max)
  
      if mode == "valid":
          slices = tuple(
              make_slice(anch, anch - filt_ext + 1)
              for anch, filt_ext in zip(anchor, kernel.shape)
          )
          out = out[slices]
  
      return out.astype(in_dtype)
  
imports: import numpy
label_desc: Use image node_id 2 for calling a global function with example usage: scipy_baseline_plane(sample, kernel, anchor, border, fill_value, mode) and returns: out