Rewritting using python-daemon PEP3143