Actually serialize and write the request.

def _write(self, request):
    """Actually serialize and write the request."""
    with sw("serialize_request"):
      request_str = request.SerializeToString()
    with sw("write_request"):
      with catch_websocket_connection_errors():
        self._sock.send(request_str)