def METHOD_NAME(items: Iterable[T], size: int) -> Iterator[List[T]]:
  """Divide items into batches of specified size.
  In case where number of items is not evenly divisible by the batch size, the
  last batch is going to be shorter.
  Args:
    items: An iterable or an iterator of items.
    size: A size of the returned batches.
  Yields:
    Lists of items with specified size.
  """
  batch = []
  for item in items:
    batch.append(item)
    if len(batch) == size:
      yield batch
      batch = []
  if batch:
    yield batch