def write(self, bytes):
        if self._lostConnection:
            return

        leftToSend = bytes
        while leftToSend:
            try:
                sent = self._tlsConnection.send(leftToSend)
            except WantReadError:
                self._writeBlockedOnRead = True
                self._appSendBuffer.append(leftToSend)
                break
            except Error, e:
                # Just drop the connection.  This has two useful consequences.
                # First, for the application protocol's connectionLost method,
                # it will squash any error into connection lost.  We *could*
                # let the real exception propagate to application code, but the
                # other SSL implementation doesn't.  Second, it causes the
                # protocol's connectionLost method to be invoked
                # non-reentrantly, which is always a nice feature.
                self._reason = Failure()
                self.transport.loseConnection()
                break
            else:
                # If we sent some bytes, the handshake must be done.  Keep
                # track of this to control error reporting behavior.
                self._handshakeDone = True
                self._flushSendBIO()
                leftToSend = leftToSend[sent:]
Process the given application bytes and send any resulting TLS traffic
dataset/ETHPy150Open kuri65536/python-for-android/python-modules/twisted/twisted/protocols/tls.py/TLSMemoryBIOProtocol.write