code: def medfilt(volume, kernel_size=None):
      """Perform a median filter on an N-dimensional array.
  
      Apply a median filter to the input array using a local window-size
      given by `kernel_size`. The array will automatically be zero-padded.
  
      Args:
          volume (cupy.ndarray): An N-dimensional input array.
          kernel_size (int or list of ints): Gives the size of the median filter
              window in each dimension. Elements of `kernel_size` should be odd.
              If `kernel_size` is a scalar, then this scalar is used as the size
              in each dimension. Default size is 3 for each dimension.
  
      Returns:
          cupy.ndarray: An array the same size as input containing the median
          filtered result.
  
      .. seealso:: :func:`cupyx.scipy.ndimage.median_filter`
      .. seealso:: :func:`scipy.signal.medfilt`
      """
      if volume.dtype.char == "e":
          # scipy doesn't support float16
          raise ValueError("float16 type not supported")
      if volume.dtype.kind == "b":
          # scipy doesn't support bool
          raise ValueError("bool type not supported")
      kernel_size = _get_kernel_size(kernel_size, volume.ndim)
      if volume.dtype.kind == "c":
          # scipy doesn't support complex
          raise ValueError("complex types not supported")
      if any(k > s for k, s in zip(kernel_size, volume.shape)):
          warnings.warn(
              "kernel_size exceeds volume extent: "
              "volume will be zero-padded"
          )
  
      size = internal.prod(kernel_size)
      return _filters.rank_filter(
          volume, size // 2, size=kernel_size, mode="constant"
      )
  
imports: import warnings
  import cupy
  from cupy._core import internal
  from cupy.linalg import lstsq
  import cupyx.scipy.fft
  from cupyx.scipy.ndimage import _util
  from cupyx.scipy.ndimage import _filters
  from cupyx.scipy.signal import _signaltools_core
  from cupyx.scipy.signal._arraytools import const_ext, even_ext, odd_ext, axis_reverse, axis_slice, axis_assign
  from cupyx.scipy.signal._iir_utils import apply_iir, apply_iir_sos, compute_correction_factors, compute_correction_factors_sos
label_desc: Use image node_id 13 for calling a global function with example usage: medfilt(volume, kernel_size) and returns: _filters