code: def _samples(
      dataset: str,
      index: int,
      batchsize: int,
      shape: Tuple[int, int],
      data_format: str,
      bounds: Bounds,
  ) -> Tuple[Any, Any]:
      # TODO: this was copied from foolbox v2
  
      from PIL import Image
  
      images, labels = [], []
      basepath = os.path.dirname(__file__)
      samplepath = os.path.join(basepath, "data")
      files = os.listdir(samplepath)
  
      if batchsize > 20:
          warnings.warn(
              "samples() has only 20 samples and repeats itself if batchsize > 20"
          )
  
      for idx in range(index, index + batchsize):
          i = idx % 20
  
          # get filename and label
          file = [n for n in files if f"{dataset}_{i:02d}_" in n][0]
          label = int(file.split(".")[0].split("_")[-1])
  
          # open file
          path = os.path.join(samplepath, file)
          image = Image.open(path)
  
          if dataset == "imagenet":
              image = image.resize(shape)
  
          image = np.asarray(image, dtype=np.float32)
  
          if image.ndim == 2:
              image = image[..., np.newaxis]
  
          assert image.ndim == 3
  
          if data_format == "channels_first":
              image = np.transpose(image, (2, 0, 1))
  
          images.append(image)
          labels.append(label)
  
      images_ = np.stack(images)
      labels_ = np.array(labels).astype(np.int64)
  
      if bounds != (0, 255):
          images_ = images_ / 255 * (bounds[1] - bounds[0]) + bounds[0]
      return images_, labels_
  
file_path: foolbox/foolbox/utils.py
imports: from typing import Optional, Tuple, Any
  import eagerpy
  import warnings
  import os
  import numpy
  from .types import Bounds
  from .models import Model
label_desc: Use image node_id 3 for calling a global function with example usage: _samples(dataset, index, batchsize, shape, data_format, bounds) and returns: images_,  labels_