code: def save_explainer(
      explainer: "Explainer", path: Union[str, os.PathLike]
  ) -> None:
      """
      Save an explainer to disk. Uses the `dill` module.
  
      Parameters
      ----------
      explainer
          Explainer instance to save to disk.
      path
          Path to a directory. A new directory will be created if one does not exist.
      """
      name = explainer.meta["name"]
      if name in NOT_SUPPORTED:
          raise NotImplementedError(
              f"Saving for {name} not yet supported"
          )
  
      path = Path(path)
  
      # create directory
      path.mkdir(parents=True, exist_ok=True)
  
      # save metadata
      meta = copy.deepcopy(explainer.meta)
      with open(Path(path, "meta.dill"), "wb") as f:
          dill.dump(meta, f)
  
      try:
          # get explainer specific save function
          save_fn = getattr(thismodule, "_save_" + name)
      except AttributeError:
          # no explainer specific functionality required, just set predictor to `None` and dump
          save_fn = _simple_save
      save_fn(explainer, path)
  
imports: import copy
  import json
  import numbers
  import os
  from pathlib import Path
  import sys
  from typing import Callable, TYPE_CHECKING, Union
  import warnings
  import dill
  import numpy
  from alibi.version import __version__
label_desc: Use image node_id 2 for calling a global function with example usage: save_explainer(explainer, path) without return types