Ping the server.  Returns the time interval, in seconds,
        required for the server to respond to the PING message.

def ping(self):
        """
        Ping the server.  Returns the time interval, in seconds,
        required for the server to respond to the PING message.
        """

        # Make sure we're connected
        if not self.conn:
            self.connect()

        # Send the ping and wait for the response
        self.conn.send('PING', time.time())
        cmd, payload = self.conn.recv()
        recv_ts = time.time()

        # Make sure the response was a PONG
        if cmd != 'PONG':
            raise Exception("Invalid response from server")

        # Return the RTT
        return recv_ts - payload[0]