Rewrite the start script in Python