'Return a handler that adjusts mxODBC\'s raised Warnings to
emit Python standard warnings.'

def _error_handler(self):

    from mx.ODBC.Error import Warning as MxOdbcWarning
    def error_handler(connection, cursor, errorclass, errorvalue):
        if issubclass(errorclass, MxOdbcWarning):
            errorclass.__bases__ = (Warning,)
            warnings.warn(message=str(errorvalue), category=errorclass, stacklevel=2)
        else:
            raise errorclass(errorvalue)
    return error_handler
