def write_asynchronously(library, session, data):
    """Writes data to device or interface asynchronously.

    Corresponds to viWriteAsync function of the VISA library.

    :param library: the visa library wrapped by ctypes.
    :param session: Unique logical identifier to a session.
    :param data: data to be written.
    :return: Job ID of this asynchronous write operation, return value of the library call.
    :rtype: jobid, :class:`pyvisa.constants.StatusCode`
    """
    job_id = ViJobId()
    # [ViSession, ViBuf, ViUInt32, ViPJobId]
    ret = library.viWriteAsync(session, data, len(data), byref(job_id))
    return job_id, ret
Writes data to device or interface asynchronously.

    Corresponds to viWriteAsync function of the VISA library.

    :param library: the visa library wrapped by ctypes.
    :param session: Unique logical identifier to a session.
    :param data: data to be written.
    :return: Job ID of this asynchronous write operation, return value of the library call.
    :rtype: jobid, :class:`pyvisa.constants.StatusCode`