code: def _save_IntegratedGradients(
      explainer: "IntegratedGradients", path: Union[str, os.PathLike]
  ) -> None:
      from alibi.explainers.integrated_gradients import LayerState
      from alibi.exceptions import SerializationError
  
      if (
          explainer.meta["params"]["layer"]
          == LayerState.NON_SERIALIZABLE
      ):
          raise SerializationError(
              "The layer provided in the explainer initialization cannot be serialized. This is due "
              "to nested layers. To permit the serialization of the explainer, provide the layer as "
              "a callable which returns the layer given the model."
          )
  
      model = explainer.model
      layer = explainer.layer
      explainer.model = explainer.layer = None
      with open(Path(path, "explainer.dill"), "wb") as f:
          dill.dump(explainer, f, recurse=True)
      explainer.model = model
      explainer.layer = layer
  
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 6 for calling a global function with example usage: _save_IntegratedGradients(explainer, path) without return types