Use itertools.repeat instead of custom version