code: def register_write(self, reg_index, value):
          
          res = self._dll.JLINKARM_WriteReg(reg_index, value)
          if res != 0:
              raise errors.JLinkException('Error writing to register %d' % reg_index)
          return value
docs: Writes into an ARM register.
  
          Note:
            The data is not immediately written, but is cached before being
            transferred to the CPU on CPU start.
  
          Args:
            self (JLink): the ``JLink`` instance
            reg_index (int): the ARM register to write to
            value (int): the value to write to the register
  
          Returns:
            The value written to the ARM register.
  
          Raises:
            JLinkException: on write error.