docs: def _process_image_files(name, filenames, texts, labels, num_shards):
    """Process and save list of images as TFRecord of Example protos.
  
    Args:
      name: string, unique identifier specifying the data set
      filenames: list of strings; each string is a path to an image file
      texts: list of strings; each string is human readable, e.g. 'dog'
      labels: list of integer; each integer identifies the ground truth
      num_shards: integer number of shards for this data set.
    """
    assert len(filenames) == len(texts)
    assert len(filenames) == len(labels)
  
    # Break all images into batches with a [ranges[i][0], ranges[i][1]].
    spacing = np.linspace(0, len(filenames), FLAGS.num_threads + 1).astype(np.int)
    ranges = []
    for i in range(len(spacing) - 1):
      ranges.append([spacing[i], spacing[i+1]])
  
    # Launch a thread for each batch.
    print('Launching %d threads for spacings: %s' % (FLAGS.num_threads, ranges))
    sys.stdout.flush()
  
    # Create a mechanism for monitoring when all threads are finished.
    coord = tf.train.Coordinator()
  
    # Create a generic TensorFlow-based utility for converting all image codings.
    coder = ImageCoder()
  
    threads = []
    for thread_index in range(len(ranges)):
      args = (coder, thread_index, ranges, name, filenames,
              texts, labels, num_shards)
      t = threading.Thread(target=_process_image_files_batch, args=args)
      t.start()
      threads.append(t)
  
    # Wait for all the threads to terminate.
    coord.join(threads)
    print('%s: Finished writing all %d images in data set.' %
          (datetime.now(), len(filenames)))
    sys.stdout.flush()