Rewrite server.py with tornado