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`.
  
      Parameters
      ----------
      volume : array_like
          An N-dimensional input array.
      kernel_size : array_like, optional
          A scalar or an N-length list giving 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
      -------
      out : ndarray
          An array the same size as input containing the median filtered
          result.
  
      """
      volume = atleast_1d(volume)
      if kernel_size is None:
          kernel_size = [3] * volume.ndim
      kernel_size = asarray(kernel_size)
      if kernel_size.shape == ():
          kernel_size = np.repeat(kernel_size.item(), volume.ndim)
  
      for k in range(volume.ndim):
          if (kernel_size[k] % 2) != 1:
              raise ValueError(
                  "Each element of kernel_size should be odd."
              )
  
      domain = ones(kernel_size)
  
      numels = product(kernel_size, axis=0)
      order = numels // 2
      return sigtools._order_filterND(volume, domain, order)
  
imports: from __future__ import division, print_function, absolute_import
  import operator
  import threading
  import sys
  import timeit
  from scipy.spatial import cKDTree
  from .None import sigtools, dlti
  from ._upfirdn import upfirdn, _output_len
  from scipy._lib.six import callable
  from scipy._lib._version import NumpyVersion
  from scipy import fftpack, linalg
  from scipy.fftpack.helper import _init_nd_shape_and_axes_sorted
  from numpy import allclose, angle, arange, argsort, array, asarray, atleast_1d, atleast_2d, cast, dot, exp, expand_dims, iscomplexobj, mean, ndarray, newaxis, ones, pi, poly, polyadd, polyder, polydiv, polymul, polysub, polyval, product, r_, ravel, real_if_close, reshape, roots, sort, take, transpose, unique, where, zeros, zeros_like
  import numpy
  import math
  from scipy.special import factorial
  from .windows import get_window
  from ._arraytools import axis_slice, axis_reverse, odd_ext, even_ext, const_ext
  from .filter_design import cheby1, _validate_sos
  from .fir_filter_design import firwin
label_desc: Use image node_id 16 for calling a global function with example usage: medfilt(volume, kernel_size) and returns: sigtools