code: def smooth_img(imgs, fwhm):
      """Smooth images by applying a Gaussian filter.
  
      Apply a Gaussian filter along the three first dimensions of `arr`.
      In all cases, non-finite values in input image are replaced by zeros.
  
      Parameters
      ----------
      imgs : Niimg-like object or iterable of Niimg-like objects
          Image(s) to smooth (see :ref:`extracting_data`
          for a detailed description of the valid input types).
      %(fwhm)s
  
      Returns
      -------
      :class:`nibabel.nifti1.Nifti1Image` or list of
          Filtered input image. If `imgs` is an iterable,
          then `filtered_img` is a list.
  
      """
      # Use hasattr() instead of isinstance to workaround a Python 2.6/2.7 bug
      # See http://bugs.python.org/issue7624
      imgs = stringify_path(imgs)
      if hasattr(imgs, "__iter__") and not isinstance(imgs, str):
          single_img = False
      else:
          single_img = True
          imgs = [imgs]
  
      ret = []
      for img in imgs:
          img = check_niimg(img)
          affine = img.affine
          filtered = smooth_array(
              get_data(img),
              affine,
              fwhm=fwhm,
              ensure_finite=True,
              copy=True,
          )
          ret.append(
              new_img_like(img, filtered, affine, copy_header=True)
          )
  
      return ret[0] if single_img else ret
  
imports: import collections.abc
  import copy
  import itertools
  import warnings
  import nibabel
  import numpy
  from joblib import Memory, Parallel, delayed
  from scipy.ndimage import gaussian_filter1d, generate_binary_structure, label
  from scipy.stats import scoreatpercentile
  from ..None import signal
  from .._utils import _repr_niimgs, as_ndarray, check_niimg, check_niimg_3d, check_niimg_4d, fill_doc
  from .._utils.exceptions import DimensionError
  from .._utils.helpers import rename_parameters, stringify_path
  from .._utils.niimg import _get_data, safe_get_data
  from .._utils.niimg_conversions import _index_img, check_same_fov, iter_check_niimg
  from .._utils.param_validation import check_threshold
  from .._utils.path_finding import resolve_globbing
label_desc: Use image node_id 5 for calling a global function with example usage: smooth_img(imgs, fwhm) and returns: unknown