code: def get_mnist(sc, data_type="train", location="/tmp/mnist"):
      """
      Get mnist dataset and parallelize into RDDs.
      Data would be downloaded automatically if it doesn't present at the specific location.
  
      :param sc: SparkContext.
      :param data_type: "train" for training data and "test" for testing data.
      :param location: Location to store mnist dataset.
      :return: RDD of (features: ndarray, label: ndarray).
      """
      (images, labels) = mnist.read_data_sets(location, data_type)
      images = sc.parallelize(images)
      labels = sc.parallelize(
          labels + 1
      )  # Target start from 1 in BigDL
      record = images.zip(labels)
      return record
  
imports: from bigdl.dllib.feature.dataset import mnist
  from bigdl.dllib.feature.dataset.transformer import *
  from bigdl.dllib.optim.optimizer import *
label_desc: Use image node_id 1 for calling a global function with example usage: get_mnist(sc, data_type, location) and returns: record