'Process the given application bytes and send any resulting TLS traffic
which arrives in the send BIO.
This may be called by C{dataReceived} with bytes that were buffered
before C{loseConnection} was called, which is why this function
doesn\'t check for disconnection but accepts the bytes regardless.'

def _write(self, bytes):

    if self._lostTLSConnection:
        return
    bufferSize = (2 ** 14)
    alreadySent = 0
    while (alreadySent < len(bytes)):
        toSend = bytes[alreadySent:(alreadySent + bufferSize)]
        try:
            sent = self._tlsConnection.send(toSend)
        except WantReadError:
            self._bufferedWrite(bytes[alreadySent:])
            break
        except Error:
            self._tlsShutdownFinished(Failure())
            break
        else:
            alreadySent += sent
            self._flushSendBIO()
