def repeatfunc(func, times=None, *args):
    """
    Repeat calls to func with specified arguments.
    Example:  repeatfunc(random.random)
    """
if times is None:
    return it.starmap(func, it.repeat(args))
return it.starmap(func, it.repeat(args, times))
python: iterator from a function