code: def _thread_worker_fn(samples, batchify_fn, dataset):
      
      if isinstance(samples[0], (list, tuple)):
          batch = [batchify_fn([dataset[i] for i in shard]) for shard in samples]
      else:
          batch = batchify_fn([dataset[i] for i in samples])
      return batch
docs: Threadpool worker function for processing data.