python: change to py-initialize in startup-hook and py-finalize in shutdown hook.