code: def _extract_mnist_labels(filename, num_labels):
      """Extract labels from an MNIST file into integers.
  
      Args:
        filename: The path to an MNIST labels file.
        num_labels: The number of labels in the file.
  
      Returns:
        A int64 numpy array of shape [num_labels]
      """
      with gzip.open(filename) as bytestream:
          bytestream.read(8)
          buf = bytestream.read(num_labels)
          labels = np.frombuffer(buf, dtype=np.uint8).astype(np.int64)
      return labels
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import gzip
  import os
  import random
  import numpy
  from tensor2tensor.data_generators import generator_utils
  from tensor2tensor.data_generators import image_utils
  from tensor2tensor.utils import registry
  import tensorflow.compat.v1
label_desc: Use image node_id 3 for calling a global function with example usage: _extract_mnist_labels(filename, num_labels) and returns: labels