parameters: (self, data)
return_statement: return len(data)
docstring: \
          Output the given string over the serial port. Can block if the
          connection is blocked. May raise SerialException if the connection is
          closed.
docstring_summary: \
          Output the given string over the serial port. Can block if the
          connection is blocked. May raise SerialException if the connection is
          closed.
docstring_tokens: \ Output the given string over the serial port . Can block if the connection is blocked . May raise SerialException if the connection is closed .
function: def write(self, data):
          """\
          Output the given string over the serial port. Can block if the
          connection is blocked. May raise SerialException if the connection is
          closed.
          """
          if not self._isOpen: raise portNotOpenError
          self._write_lock.acquire()
          try:
              try:
                  self._socket.sendall(to_bytes(data).replace(IAC, IAC_DOUBLED))
              except socket.error, e:
                  raise SerialException("connection failed (socket error): %s" % e) # XXX what exception if socket connection fails
          finally:
              self._write_lock.release()
          return len(data)
function_tokens: def write ( self , data ) : if not self . _isOpen : raise portNotOpenError self . _write_lock . acquire ( ) try : try : self . _socket . sendall ( to_bytes ( data ) . replace ( IAC , IAC_DOUBLED ) ) except socket . error , e : raise SerialException ( "connection failed (socket error): %s" % e ) # XXX what exception if socket connection fails finally : self . _write_lock . release ( ) return len ( data )