code: def chunks_generator(iterable, count_items_in_chunk):
      
      iterator = iter(iterable)
      for first in iterator:  # stops when iterator is depleted
          def chunk():  # construct generator for next chunk
              yield first  # yield element from for loop
              for more in islice(iterator, count_items_in_chunk - 1):
                  yield more  # yield more elements from the iterator
  
          yield chunk()
docs: Очень внимательно! Не дает обходить дважды
  
      :param iterable:
      :param count_items_in_chunk:
      :return: