<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def benchmark(f, n_repeats=3, warmup=True, name=""):
 """ Run the given function f repeatedly, return the average elapsed time. """

    if warmup:
        f()

    total_time = 0
    for i in range(n_repeats):
        iter_name = "%s (iter #%d)" % (name, i + 1,)
        with Timer(iter_name) as t:
            f()
        total_time += t.elapsed
    return total_time / n_repeats