def grouper(n, iterable, fillvalue=None):
    args = [iter(iterable)] * n
    return it.izip_longest(fillvalue=fillvalue, *args)
grouper(3, 'ABCDEFG', 'x') --> ABC DEF Gxx
dataset/ETHPy150Open fatcloud/PyCV-time/opencv-official-samples/3.0.0/common.py/grouper