def _chunk(iterator: Iterator[T], max_size: int) -> Iterator[List[T]]:
    ret = []
    n = 0
    for item in iterator:
        ret.append(item)
        n += 1
        if (n == max_size):
            (yield ret)
            ret = []
            n = 0
    if ret:
        (yield ret)
def _chunk(iterator: Iterator[T], max_size: int) -> Iterator[List[T]]:
    ret = []
    n = 0
    for item in iterator:
        ret.append(item)
        n += 1
        if (n == max_size):
            (yield ret)
            ret = []
            n = 0
    if ret:
        (yield ret)