rewrite server.py