def _parse10(self):

        logger.debug("parsing netconf v1.0")
        delim = MSG_DELIM
        n = len(delim) - 1
        expect = self._parsing_state10
        buf = self._buffer
        buf.seek(self._parsing_pos10)
        while True:
            x = buf.read(1)
            if isinstance(x, bytes):
                x = x.decode('UTF-8')
            if not x: # done reading
                break
            elif x == delim[expect]: # what we expected
                expect += 1 # expect the next delim char
            else:
                expect = 0
                continue
            # loop till last delim char expected, break if other char encountered
            for i in range(expect, n):
                x = buf.read(1)
                if isinstance(x, bytes):
                    x = x.decode('UTF-8')
                if not x: # done reading
                    break
                if x == delim[expect]: # what we expected
                    expect += 1 # expect the next delim char
                else:
                    expect = 0 # reset
                    break
            else: # if we didn't break out of the loop, full delim was parsed
                msg_till = buf.tell() - n
                buf.seek(0)
                logger.debug('parsed new message')
                if sys.version < '3':
                    self._dispatch_message(buf.read(msg_till).strip())
                    buf.seek(n+1, os.SEEK_CUR)
                    rest = buf.read()
                    buf = StringIO()
                else:
                    self._dispatch_message(buf.read(msg_till).strip().decode('UTF-8'))
                    buf.seek(n+1, os.SEEK_CUR)
                    rest = buf.read()
                    buf = BytesIO()
                buf.write(rest)
                buf.seek(0)
                expect = 0
        self._buffer = buf
        self._parsing_state10 = expect
        self._parsing_pos10 = self._buffer.tell()
Messages are delimited by MSG_DELIM. The buffer could have grown by
dataset/ETHPy150Open ncclient/ncclient/ncclient/transport/ssh.py/SSHSession._parse10