code: def write_imgs_to_path(*imgs, file_path=None, **kwargs):
      """Write Nifti images on disk.
  
      Write nifti images in a specified location.
  
      Parameters
      ----------
      imgs : Nifti1Image
          Several Nifti images. Every format understood by nibabel.save is
          accepted.
  
      create_files : bool
          If True, imgs are written on disk and filenames are returned. If
          False, nothing is written, and imgs is returned as output. This is
          useful to test the two cases (filename / Nifti1Image) in the same
          loop.
  
      use_wildcards : bool
          If True, and create_files is True, imgs are written on disk and a
          matching glob is returned.
  
      Returns
      -------
      filenames : string or list of strings
          Filename(s) where input images have been written. If a single image
          has been given as input, a single string is returned. Otherwise, a
          list of string is returned.
  
      """
      if file_path is None:
          file_path = Path.cwd()
  
      valid_keys = {"create_files", "use_wildcards"}
      input_keys = set(kwargs.keys())
      invalid_keys = input_keys - valid_keys
      if len(invalid_keys) > 0:
          raise TypeError(
              "%s: unexpected keyword argument(s): %s"
              % (sys._getframe().f_code.co_name, " ".join(invalid_keys))
          )
      create_files = kwargs.get("create_files", True)
      use_wildcards = kwargs.get("use_wildcards", False)
  
      prefix = "nilearn_"
      suffix = ".nii"
  
      if create_files:
          filenames = []
          with warnings.catch_warnings():
              warnings.simplefilter("ignore", RuntimeWarning)
              for i, img in enumerate(imgs):
                  filename = file_path / (prefix + str(i) + suffix)
                  filenames.append(str(filename))
                  img.to_filename(filename)
                  del img
  
              if use_wildcards:
                  return str(file_path / f"{prefix}*{suffix}")
              else:
                  if len(filenames) == 1:
                      return filenames[0]
                  return filenames
  
      else:  # No-op
          if len(imgs) == 1:
              return imgs[0]
          return imgs
  
file_path: nilearn/nilearn/_utils/testing.py
imports: import functools
  import gc
  import os
  import sys
  import tempfile
  import warnings
  from pathlib import Path
  import pytest
label_desc: Use image node_id 5 for calling a global function with example usage: write_imgs_to_path() and returns: imgs, imgs, str, filenames, filenames