code: def rtt_write(self, buffer_index, data):
          
          buf_size = len(data)
          buf = (ctypes.c_ubyte * buf_size)(*bytearray(data))
          bytes_written = self._dll.JLINK_RTTERMINAL_Write(buffer_index, buf, buf_size)
  
          if bytes_written < 0:
              raise errors.JLinkRTTException(bytes_written)
  
          return bytes_written
docs: Writes data to the RTT buffer.
  
          This method will write at most len(data) bytes to the specified RTT
          buffer.
  
          Args:
            self (JLink): the ``JLink`` instance
            buffer_index (int): the index of the RTT buffer to write to
            data (list): the list of bytes to write to the RTT buffer
  
          Returns:
            The number of bytes successfully written to the RTT buffer.
  
          Raises:
            JLinkRTTException if the underlying JLINK_RTTERMINAL_Write call fails.