python: Make the init/deinit functions optional

When there is no init or deinit function set in the config, don't even
try to call them, or we may crash.

Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>