<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def write_memory(self, *, region_name: str, offset: int = 0, value=None):
 """ Writes a value into a memory region on the QAM at a specified offset. :param region_name: Name of the declared memory region on the QAM. :param offset: Integer offset into the memory region to write to. :param value: Value to store at the indicated location. """

        assert self.status in ['loaded', 'done']

        aref = ParameterAref(name=region_name, index=offset)
        self._variables_shim[aref] = value

        return self