I noticed that the following Python function runs extremely slowly - i.e. at 1000 runs it takes 1-2 minutes to run, while the same function in C only takes 2 seconds.... is