Dont call Py_Finalize() in python function, instead return in python script