human
What is a good Python function to run a timer.
assistant
Here is a Python function to run a timer

import time

def run_on_timer(func, *args, **kwargs):
    """
    >>> func = lambda x: x + 1
    >>> run_on_timer(func, 1)
    2
    """
    start = time.time()
    result = func(*args, **kwargs)
    end = time.time()
    print(("Time taken: ", end - start))
    return result

# Enter the function
func = lambda x: x + 1

# Enter the argument
arg = 1

# Calling the function
print((run_on_timer(func, arg)))

#Example Output
# ('Time taken: ', 7.152557373046875e-07)
# 2

#Remember to inspect code for bugs.