<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, inputdata):
 """Write to a port on dummy_serial. Args: inputdata (string/bytes):
 data for sending to the port on dummy_serial. Will affect the response for subsequent read operations. Note that for Python2, the inputdata should be a **string**. For Python3 it should be of type **bytes**. """

        if VERBOSE:
            _print_out('\nDummy_serial: Writing to port. Given:' + repr(inputdata) + '\n')
            
        if sys.version_info[0] > 2:
            if not type(inputdata) == bytes:
                raise TypeError('The input must be type bytes. Given:' + repr(inputdata))
            inputstring = str(inputdata, encoding='latin1')
        else:
            inputstring = inputdata

        if not self._isOpen:
            raise IOError('Dummy_serial: Trying to write, but the port is not open. Given:' + repr(inputdata))

        # Look up which data that should be waiting for subsequent read commands
        try:
            response = RESPONSES[inputstring]
        except:
            response = DEFAULT_RESPONSE
        self._waiting_data = response