import timeit
setup = (
    """from __main__ import convert_to_celsius, convert_to_celsius_lambda, convert_to_celsius_lambda_once"""
    )
timeit.timeit("convert_to_celsius(100, 'kelvin')", setup=setup)
timeit.timeit("convert_to_celsius_lambda(100, 'kelvin')", setup=setup)
Recommended usage of Python dictionary, functions as values