<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 data to the medium. in offset of type int The byte offset into the medium to start reading at. in data of type str Array of data to write. return written of type int How many bytes were actually written. """

        if not isinstance(offset, baseinteger):
            raise TypeError("offset can only be an instance of type baseinteger")
        if not isinstance(data, list):
            raise TypeError("data can only be an instance of type list")
        for a in data[:10]:
            if not isinstance(a, basestring):
                raise TypeError(
                        "array can only contain objects of type basestring")
        written = self._call("write",
                     in_p=[offset, data])
        return written