code: def write(library, session, data):
      
      return_count = ViUInt32()
      # [ViSession, ViBuf, ViUInt32, ViPUInt32]
      ret = library.viWrite(session, data, len(data), byref(return_count))
      return return_count.value, ret
docs: Writes data to device or interface synchronously.
  
      Corresponds to viWrite 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.
      :type data: str
      :return: Number of bytes actually transferred, return value of the library call.
      :rtype: int, :class:`pyvisa.constants.StatusCode`