def enable_event(library, session, event_type, mechanism, context=None):
    """Enable event occurrences for specified event types and mechanisms in a session.

    Corresponds to viEnableEvent function of the VISA library.

    :param library: the visa library wrapped by ctypes.
    :param session: Unique logical identifier to a session.
    :param event_type: Logical event identifier.
    :param mechanism: Specifies event handling mechanisms to be enabled.
                      (Constants.VI_QUEUE, .VI_HNDLR, .VI_SUSPEND_HNDLR)
    :param context:
    :return: return value of the library call.
    :rtype: :class:`pyvisa.constants.StatusCode`
    """
    if context is None:
        context = constants.VI_NULL
    elif context != constants.VI_NULL:
        warnings.warn('In enable_event, context will be set VI_NULL.')
        context = constants.VI_NULL  # according to spec VPP-4.3, section 3.7.3.1
    return library.viEnableEvent(session, event_type, mechanism, context)
Enable event occurrences for specified event types and mechanisms in a session.

    Corresponds to viEnableEvent function of the VISA library.

    :param library: the visa library wrapped by ctypes.
    :param session: Unique logical identifier to a session.
    :param event_type: Logical event identifier.
    :param mechanism: Specifies event handling mechanisms to be enabled.
                      (Constants.VI_QUEUE, .VI_HNDLR, .VI_SUSPEND_HNDLR)
    :param context:
    :return: return value of the library call.
    :rtype: :class:`pyvisa.constants.StatusCode`