<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, handle, flags, data, timeout_ms):
 """Writes data to a running process. in handle of type int Handle to write to. Usually 0 is stdin, 1 is stdout and 2 is stderr. in flags of type int A combination of :py:class:`ProcessInputFlag` flags. in data of type str Array of bytes to write. The size of the array also specifies how much to write. in timeout_ms of type int Timeout (in ms) to wait for the operation to complete. Pass 0 for an infinite timeout. return written of type int How many bytes were written. """

        if not isinstance(handle, baseinteger):
            raise TypeError("handle can only be an instance of type baseinteger")
        if not isinstance(flags, baseinteger):
            raise TypeError("flags 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")
        if not isinstance(timeout_ms, baseinteger):
            raise TypeError("timeout_ms can only be an instance of type baseinteger")
        written = self._call("write",
                     in_p=[handle, flags, data, timeout_ms])
        return written