def ping(self, reconnect=True):
        try:
            self._execute_command(COM_PING, "")
            pkt = self.read_packet()
            return pkt.is_ok_packet()
        except:
            if reconnect:
                self._connect()
                return self.ping(False)
            else:
                exc,value,tb = sys.exc_info()
                self.errorhandler(None, exc, value)
                return
Check if the server is alive
dataset/ETHPy150Open uwdata/termite-data-server/web2py/gluon/contrib/pymysql/connections.py/Connection.ping