code: def create_storage(
      keep_in_memory: bool = False,
      cache_folder: str | PathLike | None = None,
      cache_mode: Literal["pickle", "hdf5"] = "hdf5",
      checkpoint_folder: str | PathLike | None = None,
  ):
      if keep_in_memory:
          storage_cls = MemoryStorage
          storage_args = []
          storage_kwargs = {}
      elif cache_mode == "pickle":
          storage_cls = FileStorage
          if cache_folder is None:
              cache_folder = _create_temp_folder()
          storage_args = []
          storage_kwargs = {"cache_folder": cache_folder}
      elif cache_mode == "hdf5":
          storage_cls = HDF5Storage
          if cache_folder is None:
              cache_folder = _create_temp_folder()
          storage_args = []
          storage_kwargs = {"cache_folder": cache_folder}
  
      if checkpoint_folder is not None:
          storage_kwargs["checkpoint_folder"] = checkpoint_folder
          return storage_cls.from_checkpoint(
              *storage_args, **storage_kwargs
          )
      else:
          return storage_cls(*storage_args, **storage_kwargs)
  
imports: from __future__ import annotations
  import logging
  import os
  from os import PathLike
  from pathlib import Path
  import shutil
  import tempfile
  from typing import Any, Dict, List, Literal
  import json_tricks
  from .utils import pickle_dump, pickle_load
label_desc: Use image node_id 1 for calling a global function with example usage: create_storage(keep_in_memory, cache_folder, cache_mode, checkpoint_folder) and returns: storage_cls, storage_cls