def write(self, s):
try:<EOL><INDENT>return self.handle.write(s)<EOL><DEDENT>except (OSError, serial.SerialException,<EOL>serial.writeTimeoutError) as e:<EOL><INDENT>if e == serial.writeTimeoutError:<EOL><INDENT>print("<STR_LIT>")<EOL>return <NUM_LIT:0><EOL><DEDENT>else:<EOL><INDENT>print()<EOL>print("<STR_LIT>")<EOL>print()<EOL>self.handle.close()<EOL>raise IOError<EOL><DEDENT><DEDENT>
Write wrapper.

Parameters
----------
s : bytes
  Bytes to write