code: def chunk_iter(iterable, chunk_size):
      '''A generator that yields chunks of iterable, chunk_size at a time. '''
      while True:
          chunk = []
          try:
              for _ in range(chunk_size): chunk.append(next(iterable))
              yield chunk
          except StopIteration:
              if chunk: yield chunk
              breaf chunk_iter(iterable, chunk_size):
      '''A generator that yields chunks of iterable, chunk_size at a time. '''
      while True:
          chunk = []
          try:
              for _ in range(chunk_size): chunk.append(next(iterable))
              yield chunk
          except StopIteration:
              if chunk: yield chunk
              break
docs: A generator that yields chunks of iterable, chunk_size at a time.