code: def get_instance(
      cls=_AdversarialFairness,
      fake_mixin=False,
      fake_training=False,
      torch=True,
      tensorflow=False,
      **kwargs,
  ):
      """
      Shared set up of test cases that create an instance of the model.
  
      Parameters
      ----------
      cls : class
          class to initialize, should be (sub)class (of) AdversarialFairness
  
      fake_mixin: bool
          use an entirely fake backendEngine
  
      fake_training: bool
          only remove training step from backendEngine
  
      torch: bool
          Use torch (and set the fake torch module)
  
      tensorflow: bool
          Use tensorflow (and set the fake tensorflow module)
      """
      if torch:
          sys.modules["torch"] = fake_torch
      else:
          sys.modules["torch"] = None
      if tensorflow:
          sys.modules["tensorflow"] = fake_tensorflow
      else:
          sys.modules["tensorflow"] = None
  
      default_kwargs = dict()
  
      if torch:
          default_kwargs["predictor_model"] = fake_torch.nn.Module()
          default_kwargs["adversary_model"] = fake_torch.nn.Module()
      elif tensorflow:
          default_kwargs[
              "predictor_model"
          ] = fake_tensorflow.keras.Model()
          default_kwargs[
              "adversary_model"
          ] = fake_tensorflow.keras.Model()
  
      default_kwargs.update(kwargs)
      mitigator = cls(**default_kwargs)
  
      if fake_mixin:
          mitigator.backend = RemoveAll
      elif fake_training:
          if tensorflow:
              mitigator.backend = RemoveTrainStepTensorflow
          if torch:
              mitigator.backend = RemoveTrainStepPytorch
  
      return mitigator
  
imports: import sys
  import numpy
  from fairlearn.adversarial._adversarial_mitigation import _AdversarialFairness
  from fairlearn.adversarial._pytorch_engine import PytorchEngine
  from fairlearn.adversarial._tensorflow_engine import TensorflowEngine
  from fairlearn.adversarial._backend_engine import BackendEngine
label_desc: Use image node_id 3 for calling a global function with example usage: get_instance(cls, fake_mixin, fake_training, torch, tensorflow) and returns: mitigator