code: def extract_labels(filename):
      """Extract the labels into a 1D uint8 numpy array [index]."""
      with gzip.open(filename) as bytestream:
          magic = _read32(bytestream)
          if magic != 2049:
              raise ValueError(
                  "Invalid magic number %d in MNIST label file: %s"
                  % (magic, filename)
              )
          num_items = _read32(bytestream)
          buf = bytestream.read(num_items)
          labels = numpy.frombuffer(buf, dtype=numpy.uint8)
          return labels
  
file_path: tensorpack/tensorpack/dataflow/dataset/mnist.py
imports: import gzip
  import numpy
  import os
  from ...utils import logger
  from ...utils.fs import download, get_dataset_path
  from ..base import RNGDataFlow
label_desc: Use image node_id 4 for calling a global function with example usage: extract_labels(filename) and returns: labels