code: def extract_labels(f):
      print("Extracting", f.name)
      with gzip.GzipFile(fileobj=f) as bytestream:
          magic = _read32(bytestream)
          if magic != 2049:
              invalidInputError(
                  False,
                  "Invalid magic number %d in MNIST label file: %s"
                  % (magic, f.name),
              )
          num_items = _read32(bytestream)
          buf = bytestream.read(num_items)
          labels = numpy.frombuffer(buf, dtype=numpy.uint8)
          return labels
  
file_path: BigDL/python/dllib/src/bigdl/dllib/keras/datasets/mnist.py
imports: import gzip
  import numpy
  from bigdl.dllib.feature.dataset import base
  from bigdl.dllib.utils.log4Error import *
label_desc: Use image node_id 3 for calling a global function with example usage: extract_labels(f) and returns: labels