Actually it could accept any generator if slicing in line 143 was replaced by `itertools.islice`.