def write(self, s):
try:<EOL><INDENT>self._write_lock.acquire()<EOL>self.handle.sendall(s)<EOL><DEDENT>except socket.timeout:<EOL><INDENT>self._connect()<EOL><DEDENT>except socket.error:<EOL><INDENT>raise IOError<EOL><DEDENT>finally:<EOL><INDENT>self._write_lock.release()<EOL><DEDENT>
Write wrapper.

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