added lock around translate_function_value for multithreaded python code