code: def fetch_batch(self):
          
          inp, f = self.queue.get()
          nr_input_var = len(inp)
          batched, futures = [[] for _ in range(nr_input_var)], []
          for k in range(nr_input_var):
              batched[k].append(inp[k])
          futures.append(f)
          while len(futures) < self.batch_size:
              try:
                  inp, f = self.queue.get_nowait()
                  for k in range(nr_input_var):
                      batched[k].append(inp[k])
                  futures.append(f)
              except queue.Empty:
                  break   # do not wait
  
          for k in range(nr_input_var):
              batched[k] = np.asarray(batched[k])
          return batched, futures
docs: Fetch a batch of data without waiting