Pidfile featuring stale detection and file-locking, can also be used as context-manager or decorator WWW: https://pypi.org/project/pid/