python daemon adapted to python 3