code: def save_with_fn(
      path,
      object,
      pickle_fn,
      format=None,
      verbose=True,
      compression_fn=None,
      compression_fn_kwargs=None,
  ):
      if verbose:
          logger.log(15, "Saving " + str(path))
      if s3_utils.is_s3_url(path):
          format = "s3"
      if format == "s3":
          save_s3(path, object, pickle_fn, verbose=verbose)
      else:
          path_parent = os.path.dirname(path)
          if path_parent == "":
              path_parent = "."  # Allows saving to working directory root without crashing
          os.makedirs(path_parent, exist_ok=True)
  
          if compression_fn_kwargs is None:
              compression_fn_kwargs = {}
  
          with compression_fn_map[compression_fn]["open"](
              path, "wb", **compression_fn_kwargs
          ) as fout:
              pickle_fn(object, fout)
  
file_path: autogluon/common/src/autogluon/common/savers/save_pkl.py
imports: import logging
  import os
  import pickle
  import tempfile
  from ..utils import compression_utils, s3_utils
label_desc: Use image node_id 2 for calling a global function with example usage: save_with_fn(path, object, pickle_fn, format, verbose, compression_fn, compression_fn_kwargs) without return types