Python classes based on the twisted framework to support graceful startup and shutdown of applications