code: def _short_repr(niimg_rep, shorten=True, truncate=20):
      """Give a shorter version of niimg representation."""
      # Make sure truncate has a reasonable value
      truncate = max(truncate, 10)
      path_to_niimg = Path(niimg_rep)
      if not shorten:
          return str(path_to_niimg)
      # If the name of the file itself is larger than
      # truncate, then shorten the name only
      if len(path_to_niimg.name) > truncate:
          return f"{path_to_niimg.name[: (truncate - 2)]}..."
      # Else add some folder structure if available
      else:
          rep = path_to_niimg.name
          if len(path_to_niimg.parts) > 1:
              for p in path_to_niimg.parts[::-1][1:]:
                  if len(rep) + len(p) < truncate - 3:
                      rep = str(Path(p, rep))
                  else:
                      rep = str(Path("...", rep))
                      break
          return rep
  
file_path: nilearn/nilearn/_utils/niimg.py
imports: import collections.abc
  import copy
  import gc
  from pathlib import Path
  from warnings import warn
  import nibabel
  import numpy
  from .helpers import stringify_path
label_desc: Use image node_id 7 for calling a global function with example usage: _short_repr(niimg_rep, shorten, truncate) and returns: str, path_to_niimg, str, rep