def grouper(n, iterable, padvalue=None):
    """grouper(3, 'abcdefg', 'x') --> ('a','b','c'), ('d','e','f'), ('g','x','x')"""
return zip_longest(fillvalue=padvalue, *([iter(iterable)] * n))
How do you split a list into evenly sized chunks?