def most_even_chunk(string, group):
    """Divide a string into a list of strings as even as possible."""
    counts = [0] + most_even(len(string), group)
    indices = accumulate(counts)
    slices = window(indices, 2)
    return [string[slice(*one)] for one in slices]
def most_even_chunk ( string , group ) : counts = [ 0 ] + most_even ( len ( string ) , group ) indices = accumulate ( counts ) slices = window ( indices , 2 ) return [ string [ slice ( * one ) ] for one in slices ]
Divide a string into a list of strings as even as possible.