text: import numpy as np
  
  
  def batched(iterator, batch_size):
      """Group a numerical stream into batches and yield them as Numpy arrays."""
      while True:
          data = np.zeros(batch_size)
          target = np.zeros(batch_size)
          for index in range(batch_size):
              data[index], target[index] = next(iterator)
          yield data, target