code: def _parallel_extracter(
      data_dir, number_of_test, number_of_dev, total, counter
  ):
      """Generate a function to extract a tar file based on given parameters
      This works by currying the above given arguments into a closure
      in the form of the following function.
  
      :param data_dir:       the target directory to extract into
      :param number_of_test: the number of files to keep as the test set
      :param number_of_dev:  the number of files to keep as the dev set
      :param total:          the total number of files to extract
      :param counter:        an atomic counter to keep track of # of extracted files
      :return:               a function that actually extracts a tar file given these params
      """
  
      def extract(d):
          """Binds data_dir, number_of_test, number_of_dev, total, and counter into this scope
          Extracts the given file
          :param d: a tuple consisting of (index, file) where index is the index
                    of the file to extract and file is the name of the file to extract
          """
          (i, archive) = d
          if i < number_of_test:
              dataset_dir = path.join(data_dir, "test")
          elif i < number_of_test + number_of_dev:
              dataset_dir = path.join(data_dir, "dev")
          else:
              dataset_dir = path.join(data_dir, "train")
          if not gfile.Exists(
              os.path.join(
                  dataset_dir,
                  ".".join(filename_of(archive).split(".")[:-1]),
              )
          ):
              c = counter.increment()
              print(
                  "Extracting file {} ({}/{})...".format(
                      i + 1, c, total
                  )
              )
              tar = tarfile.open(archive)
              tar.extractall(dataset_dir)
              tar.close()
  
      return extract
  
imports: import codecs
  import os
  import re
  import sys
  import tarfile
  import threading
  import unicodedata
  import urllib
  from glob import glob
  from multiprocessing.pool import ThreadPool
  from os import makedirs, path
  import pandas
  from bs4 import BeautifulSoup
  from tensorflow.python.platform import gfile
  from deepspeech_training.util.downloader import maybe_download
label_desc: Use image node_id 2 for calling a global function with example usage: _parallel_extracter(data_dir, number_of_test, number_of_dev, total, counter) and returns: extract