code: def train_set_producer(socket, train_archive, patch_archive, wnid_map):
      
      patch_images = extract_patch_images(patch_archive, 'train')
      num_patched = 0
      with tar_open(train_archive) as tar:
          for inner_tar_info in tar:
              with tar_open(tar.extractfile(inner_tar_info.name)) as inner:
                  wnid = inner_tar_info.name.split('.')[0]
                  class_index = wnid_map[wnid]
                  filenames = sorted(info.name for info in inner
                                     if info.isfile())
                  images_gen = (load_from_tar_or_patch(inner, filename,
                                                       patch_images)
                                for filename in filenames)
                  pathless_filenames = (os.path.split(fn)[-1]
                                        for fn in filenames)
                  stream = equizip(pathless_filenames, images_gen)
                  for image_fn, (image_data, patched) in stream:
                      if patched:
                          num_patched += 1
                      socket.send_pyobj((image_fn, class_index), zmq.SNDMORE)
                      socket.send(image_data)
      if num_patched != len(patch_images):
          raise ValueError('not all patch images were used')
docs: Load/send images from the training set TAR file or patch images.
  
      Parameters
      ----------
      socket : :class:`zmq.Socket`
          PUSH socket on which to send loaded images.
      train_archive :  str or file-like object
          Filename or file handle for the TAR archive of training images.
      patch_archive :  str or file-like object
          Filename or file handle for the TAR archive of patch images.
      wnid_map : dict
          A dictionary that maps WordNet IDs to 0-based class indices.
          Used to decode the filenames of the inner TAR files.