.functions: Improve `server`

Make server function:

 * also work with python 3
 * better detect when the server is up and running