code: def process_i1k_tar_subpath(args):
      """
      Process a single subpath in a I1K tar. By process:
          optionally untar recursive tars (only on 'train')
          resize/copy images
      Returns a list of [(fname, label), ...]
      """
      target_size, toptar, img_dir, setn, label_dict, subpath = args
      name_slice = slice(None, 9) if setn == "train" else slice(15, -5)
      label = label_dict[subpath.name[name_slice]]
      outpath = os.path.join(img_dir, str(label))
      if setn == "train":
          tf = tarfile.open(toptar)
          subtar = tarfile.open(fileobj=tf.extractfile(subpath))
          file_list = subtar.getmembers()
          return process_files_in_tar(
              target_size, label, subtar, file_list, outpath
          )
      elif setn == "val":
          tf = tarfile.open(toptar)
          file_list = [subpath]
          return process_files_in_tar(
              target_size, label, tf, file_list, outpath
          )
  
imports: from builtins import str, zip
  from configargparse import ArgParser
  from itertools import repeat
  from neon import logger
  from neon.util.persist import ensure_dirs_exist
  from PIL import Image
  import logging
  import multiprocessing
  import numpy
  import os
  import re
  import shutil
  import tarfile
  import tqdm
  import zlib
label_desc: Use image node_id 1 for calling a global function with example usage: process_i1k_tar_subpath(args) and returns: process_files_in_tar, process_files_in_tar