Better code to insert timed function wrapper for python