def METHOD_NAME(connection, cursor, errorclass, errorvalue):
    if issubclass(errorclass, MxOdbcWarning):
        errorclass.__bases__ = (Warning,)
        warnings.warn(message=str(errorvalue),
                      category=errorclass,
                      stacklevel=2)
    else:
        raise errorclass(errorvalue)