code: def image_iterator(
      framework, get_default_mnist_subset, default_batch_size
  ):
      (x_train_mnist, y_train_mnist), (_, _) = get_default_mnist_subset
  
      def _get_image_iterator():
          if framework == "keras" or framework == "kerastf":
              from keras.preprocessing.image import ImageDataGenerator
  
              keras_gen = ImageDataGenerator(
                  width_shift_range=0.075,
                  height_shift_range=0.075,
                  rotation_range=12,
                  shear_range=0.075,
                  zoom_range=0.05,
                  fill_mode="constant",
                  cval=0,
              )
              return keras_gen.flow(
                  x_train_mnist,
                  y_train_mnist,
                  batch_size=default_batch_size,
              )
  
          if framework in ["tensorflow1", "tensorflow2v1"]:
              import tensorflow.compat.v1 as tf
  
              x_tensor = tf.convert_to_tensor(
                  x_train_mnist.reshape(10, 100, 28, 28, 1)
              )
              y_tensor = tf.convert_to_tensor(
                  y_train_mnist.reshape(10, 100, 10)
              )
              dataset = tf.data.Dataset.from_tensor_slices(
                  (x_tensor, y_tensor)
              )
              return dataset.make_initializable_iterator()
  
          if framework == "tensorflow2":
              import tensorflow as tf
  
              dataset = tf.data.Dataset.from_tensor_slices(
                  (x_train_mnist, y_train_mnist)
              ).batch(default_batch_size)
              return dataset
  
          if framework in ["pytorch", "huggingface"]:
              import torch
  
              # Create tensors from data
              x_train_tens = torch.from_numpy(x_train_mnist)
              x_train_tens = x_train_tens.float()
              y_train_tens = torch.from_numpy(y_train_mnist)
              dataset = torch.utils.data.TensorDataset(
                  x_train_tens, y_train_tens
              )
              return torch.utils.data.DataLoader(
                  dataset=dataset,
                  batch_size=default_batch_size,
                  shuffle=True,
              )
  
          if framework == "mxnet":
              from mxnet import gluon
  
              dataset = gluon.data.dataset.ArrayDataset(
                  x_train_mnist, y_train_mnist
              )
              return gluon.data.DataLoader(
                  dataset, batch_size=5, shuffle=True
              )
  
          return None
  
      return _get_image_iterator
  
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 7 for calling a global function with example usage: image_iterator(framework, get_default_mnist_subset, default_batch_size) and returns: _get_image_iterator, None, keras_gen, dataset, dataset, torch, gluon