code: def open_file_or_filename(unknown_file_thing):
      """Try to open the provided file "thing" if needed, otherwise return the filename or Path.
  
      This wraps the logic of getting something like an fsspec OpenFile object
      that is not directly supported by most reading libraries and making it
      usable. If a :class:`pathlib.Path` object or something that is not
      open-able is provided then that object is passed along. In the case of
      fsspec OpenFiles their ``.open()`` method is called and the result returned.
  
      """
      if isinstance(unknown_file_thing, pathlib.Path):
          f_obj = unknown_file_thing
      else:
          try:
              f_obj = unknown_file_thing.open()
          except AttributeError:
              f_obj = unknown_file_thing
      return f_obj
  
imports: from __future__ import annotations
  import logging
  import os
  import pathlib
  import pickle
  import warnings
  from datetime import datetime, timedelta
  from functools import total_ordering
  import yaml
  from yaml import UnsafeLoader
  from satpy._config import config_search_paths, get_entry_points_config_dirs, glob_config
  from .yaml_reader import AbstractYAMLReader
  from .yaml_reader import load_yaml_configs
label_desc: Use image node_id 22 for calling a global function with example usage: open_file_or_filename(unknown_file_thing) and returns: f_obj