code: def guessed_image_type(filename):
      """Guess image type from file `filename`
  
      Parameters
      ----------
      filename : str
          File name containing an image
  
      Returns
      -------
      image_class : class
          Class corresponding to guessed image type
      """
      sniff = None
      for image_klass in all_image_classes:
          is_valid, sniff = image_klass.path_maybe_image(
              filename, sniff
          )
          if is_valid:
              return image_klass
  
      raise ImageFileError(f'Cannot work out file type of "{filename}"')
  
file_path: nibabel/nibabel/loadsave.py
imports: from __future__ import annotations
  import os
  import typing
  import numpy
  from .arrayproxy import is_proxy
  from .deprecated import deprecate_with_version
  from .filebasedimages import ImageFileError
  from .filename_parser import _stringify_path, splitext_addext
  from .imageclasses import all_image_classes
  from .openers import ImageOpener
label_desc: Use image node_id 3 for calling a global function with example usage: guessed_image_type(filename) and returns: image_klass