code: def decide(model_interface, method):
      """Decides DiCE implementation type.
  
      To add new implementations of DiCE, add the class in explainer_interfaces
      subpackage and import-and-return the class in an elif loop as shown in
      the below method.
      """
      if method == SamplingStrategy.Random:
          # random sampling of CFs
          from dice_ml.explainer_interfaces.dice_random import (
              DiceRandom,
          )
  
          return DiceRandom
      elif method == SamplingStrategy.Genetic:
          from dice_ml.explainer_interfaces.dice_genetic import (
              DiceGenetic,
          )
  
          return DiceGenetic
      elif method == SamplingStrategy.KdTree:
          from dice_ml.explainer_interfaces.dice_KD import DiceKD
  
          return DiceKD
      elif method == SamplingStrategy.Gradient:
          if model_interface.backend == BackEndTypes.Tensorflow1:
              # pretrained Keras Sequential model with Tensorflow 1.x backend
              from dice_ml.explainer_interfaces.dice_tensorflow1 import (
                  DiceTensorFlow1,
              )
  
              return DiceTensorFlow1
  
          elif model_interface.backend == BackEndTypes.Tensorflow2:
              # pretrained Keras Sequential model with Tensorflow 2.x backend
              from dice_ml.explainer_interfaces.dice_tensorflow2 import (
                  DiceTensorFlow2,
              )
  
              return DiceTensorFlow2
  
          elif model_interface.backend == BackEndTypes.Pytorch:
              # PyTorch backend
              from dice_ml.explainer_interfaces.dice_pytorch import (
                  DicePyTorch,
              )
  
              return DicePyTorch
          else:
              raise UserConfigValidationException(
                  "{0} is only supported for differentiable neural network models. "
                  "Please choose one of {1}, {2} or {3}".format(
                      method,
                      SamplingStrategy.Random,
                      SamplingStrategy.Genetic,
                      SamplingStrategy.KdTree,
                  )
              )
      elif method is None:
          # all other backends
          backend_dice = model_interface.backend["explainer"]
          module_name, class_name = backend_dice.split(".")
          module = __import__(
              "dice_ml.explainer_interfaces." + module_name,
              fromlist=[class_name],
          )
          return getattr(module, class_name)
      else:
          raise UserConfigValidationException(
              "Unsupported sample strategy {0} provided. "
              "Please choose one of {1}, {2} or {3}".format(
                  method,
                  SamplingStrategy.Random,
                  SamplingStrategy.Genetic,
                  SamplingStrategy.KdTree,
              )
          )
  
file_path: DiCE/dice_ml/dice.py
imports: from raiutils.exceptions import UserConfigValidationException
  from dice_ml.constants import BackEndTypes, SamplingStrategy
  from dice_ml.data_interfaces.private_data_interface import PrivateData
  from dice_ml.explainer_interfaces.explainer_base import ExplainerBase
label_desc: Use image node_id 1 for calling a global function with example usage: decide(model_interface, method) and returns: DiceRandom, DiceGenetic, DiceKD, DiceTensorFlow1, getattr, DiceTensorFlow2, DicePyTorch