Itertools recipe
    >>> list(grouper(3, iter('ABCDEFG')))
    [['A', 'B', 'C'], ['D', 'E', 'F'], ['G']]

def grouper(n, iterable):
    """Itertools recipe
    >>> list(grouper(3, iter('ABCDEFG')))
    [['A', 'B', 'C'], ['D', 'E', 'F'], ['G']]
    """
    return (iterable[i:i + n] for i in range(0, len(iterable), n))