<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(self, offset, data):
 """Write a string of bytes to the specified `offset` in bytes, relative to the base physical address of the MMIO region. Args: offset (int, long):
 offset from base physical address, in bytes. data (bytes, bytearray, list):
 a byte array or list of 8-bit integers to write. Raises: TypeError: if `offset` or `data` type are invalid. ValueError: if `offset` is out of bounds, or if data is not valid bytes. """

        if not isinstance(offset, (int, long)):
            raise TypeError("Invalid offset type, should be integer.")
        if not isinstance(data, (bytes, bytearray, list)):
            raise TypeError("Invalid data type, expected bytes, bytearray, or list.")

        offset = self._adjust_offset(offset)
        self._validate_offset(offset, len(data))

        data = bytes(bytearray(data))
        self.mapping[offset:offset + len(data)] = data