Why do I get the exception "global name 'test' is not defined" in this code (next to last line) and how do I fix it? import timeit def test(): x=2+2 t = timeit.Timer('test()') print t.timeit()