def get_chunks ( source , chunk_len ) : return ( source [ i : i + chunk_len ] for i in range ( 0 , len ( source ) , chunk_len ) )
python iterator get chunk
Returns an iterator over chunk_len chunks of source
def get_chunks(source, chunk_len):
    """ Returns an iterator over 'chunk_len' chunks of 'source' """
    return (source[i: i + chunk_len] for i in range(0, len(source), chunk_len))