docs: def _cursor(self, *args, **kwargs):
          """A "tough" version of the method cursor()."""
          # The args and kwargs are not part of the standard,
          # but some database modules seem to use these.
          transaction = self._transaction
          if not transaction:
              self._ping_check(2)
          try:
              if self._maxusage:
                  if self._usage >= self._maxusage:
                      # the connection was used too often
                      raise self._failure
              cursor = self._con.cursor(*args, **kwargs)  # try to get a cursor
          except self._failures as error:  # error in getting cursor
              try:  # try to reopen the connection
                  con = self._create()
              except Exception:
                  pass
              else:
                  try:  # and try one more time to get a cursor
                      cursor = con.cursor(*args, **kwargs)
                  except Exception:
                      pass
                  else:
                      self._close()
                      self._store(con)
                      if transaction:
                          raise error  # re-raise the original error again
                      return cursor
                  try:
                      con.close()
                  except Exception:
                      pass
              if transaction:
                  self._transaction = False
              raise error  # re-raise the original error again
          return cursor