Py3 compat for bokeh server with different backends

This PR fixes the issues about py3 incompatibilities in the bokeh-server implementation (tested in my linux environment with the three backends). I keep the changes at minimum to make it work... we can probably make it more consistent, but I don't want to introduce more changes without not knowing the bokeh-server implementation in deep.