def repeater(fun, num_repeats):
    """
    Returns a new function f. f should take a single input i, and return
    fun applied to i num_repeats times. In other words, if num_repeats is 1, f
    should return fun(i). If num_repeats is 2, f should return fun(fun(i)). If
    num_repeats is 0, f should return i.
    :param fun: function
    :param num_repeats: int
    :return: function
    """
    def retfun(x):
        # Fill in
        i = 0
        if num_repeats > 0:
            while i < num_repeats:
                x = fun(x)
                i += 1
            return x
        elif num_repeats == 0:
            return x
        pass
    return retfun