def generate_chunks(data, chunk_size=DEFAULT_CHUNK_SIZE):
iterator = iter(repeated.getvalues(data))<EOL>while True:<EOL><INDENT>chunk = list(itertools.islice(iterator, chunk_size))<EOL>if not chunk:<EOL><INDENT>return<EOL><DEDENT>yield chunk<EOL><DEDENT>
Yield 'chunk_size' items from 'data' at a time.