code: def image_dl_estimator_defended(framework):
      def _image_dl_estimator_defended(one_classifier=False, **kwargs):
          sess = None
          classifier = None
  
          clip_values = (0, 1)
          fs = FeatureSqueezing(bit_depth=2, clip_values=clip_values)
  
          defenses = []
          if kwargs.get("defenses") is None:
              defenses.append(fs)
          else:
              if "FeatureSqueezing" in kwargs.get("defenses"):
                  defenses.append(fs)
              if "JpegCompression" in kwargs.get("defenses"):
                  defenses.append(
                      JpegCompression(
                          clip_values=clip_values, apply_predict=True
                      )
                  )
              if "SpatialSmoothing" in kwargs.get("defenses"):
                  defenses.append(SpatialSmoothing())
              del kwargs["defenses"]
  
          if framework == "tensorflow2":
              classifier, _ = get_image_classifier_tf(**kwargs)
  
          if framework == "keras":
              classifier = get_image_classifier_kr(**kwargs)
  
          if framework == "kerastf":
              classifier = get_image_classifier_kr_tf(**kwargs)
  
          if framework == "pytorch":
              classifier = get_image_classifier_pt(**kwargs)
              for i, defense in enumerate(defenses):
                  if "channels_first" in defense.params:
                      defenses[
                          i
                      ].channels_first = classifier.channels_first
  
          if classifier is not None:
              classifier.set_params(preprocessing_defences=defenses)
          else:
              raise ARTTestFixtureNotImplemented(
                  "no defended image estimator",
                  image_dl_estimator_defended.__name__,
                  framework,
                  {"defenses": defenses},
              )
  
          return classifier, sess
  
      return _image_dl_estimator_defended
  
imports: import importlib
  import json
  import logging
  import os
  import shutil
  import tempfile
  from typing import Dict, List, TYPE_CHECKING, Union
  import warnings
  import numpy
  import pytest
  import requests
  from art.data_generators import KerasDataGenerator, MXDataGenerator, PyTorchDataGenerator, TensorFlowDataGenerator, TensorFlowV2DataGenerator
  from art.defences.preprocessor import FeatureSqueezing, JpegCompression, SpatialSmoothing
  from art.estimators.classification import KerasClassifier
  from tests.utils import ARTTestFixtureNotImplemented, get_attack_classifier_pt, get_image_classifier_kr, get_image_classifier_kr_functional, get_image_classifier_kr_tf, get_image_classifier_kr_tf_functional, get_image_classifier_kr_tf_with_wildcard, get_image_classifier_mxnet_custom_ini, get_image_classifier_pt, get_image_classifier_pt_functional, get_image_classifier_tf, get_image_classifier_hf, get_image_gan_tf_v2, get_image_generator_tf_v2, get_tabular_classifier_kr, get_tabular_classifier_pt, get_tabular_classifier_scikit_list, get_tabular_classifier_tf, load_dataset, master_seed
label_desc: Use image node_id 3 for calling a global function with example usage: image_dl_estimator_defended(framework) and returns: _image_dl_estimator_defended, classifier,  sess