code: def ping(self) -> None:
          
          if self.db is None or self.db_pythonlib not in [PYTHONLIB_MYSQLDB,
                                                          PYTHONLIB_PYMYSQL]:
              return
          try:
              self.db.ping(True)  # test connection; reconnect upon failure
              # ... should auto-reconnect; however, it seems to fail the first
              # time, then work the next time.
              # Exception (the first time) is:
              # <class '_mysql_exceptions.OperationalError'>:
              #   (2006, 'MySQL server has gone away')
              # http://mail.python.org/pipermail/python-list/2008-February/
              #        474598.html
          except mysql.OperationalError:  # loss of connection
              self.db = None
              self.connect_to_database_mysql(
                  self._database, self._user, self._password, self._server,
                  self._port, self._charset, self._use_unicode)
docs: Pings a database connection, reconnecting if necessary.