refactor watchdog_python.py