code: def __init__(self, custom_preprocessing=None, dirpath=None):
      self._dirpath = dirpath
      if not self._dirpath:
          self._dirpath = os.path.join(
              os.path.dirname(os.path.abspath(__file__)),
              "..",
              "data",
              "mnist_data",
          )
  
      files = [
          "train-images-idx3-ubyte.gz",
          "t10k-images-idx3-ubyte.gz",
          "train-labels-idx1-ubyte.gz",
          "t10k-labels-idx1-ubyte.gz",
      ]
      for name in files:
          if not os.path.exists(self._dirpath + "/" + name):
              print("retrieving file", name)
              urllib.request.urlretrieve(
                  "http://yann.lecun.com/exdb/mnist/" + name,
                  self._dirpath + "/" + name,
              )
              print("retrieved")
  
      train_data = extract_data(
          self._dirpath + "/train-images-idx3-ubyte.gz", 60000
      )
      train_labels = extract_labels(
          self._dirpath + "/train-labels-idx1-ubyte.gz", 60000
      )
      self.test_data = extract_data(
          self._dirpath + "/t10k-images-idx3-ubyte.gz", 10000
      )
      self.test_labels = extract_labels(
          self._dirpath + "/t10k-labels-idx1-ubyte.gz", 10000
      )
  
      VALIDATION_SIZE = 5000
  
      self.validation_data = train_data[:VALIDATION_SIZE, :, :, :]
      self.validation_labels = train_labels[:VALIDATION_SIZE]
      self.train_data = train_data[VALIDATION_SIZE:, :, :, :]
      self.train_labels = train_labels[VALIDATION_SIZE:]
  
imports: import numpy
  import os
  import gzip
  import urllib.request
label_desc: Use image node_id 1 to create a new MNISTDataset object  with example: obj = MNISTDataset(custom_preprocessing, dirpath)