def test_carriageReturn(self):
        """
        A carriage return only puts the protocol into the newline state.  A
        linefeed in the newline state causes just the newline to be
        delivered.  A nul in the newline state causes a carriage return to
        be delivered.  An IAC in the newline state causes a carriage return
        to be delivered and puts the protocol into the escaped state.
        Anything else causes a carriage return and that thing to be
        delivered.
        """
        self._deliver(b'\r')
        self._deliver(b'\n', ('bytes', b'\n'))
        self._deliver(b'\r\n', ('bytes', b'\n'))

        self._deliver(b'\r')
        self._deliver(b'\0', ('bytes', b'\r'))
        self._deliver(b'\r\0', ('bytes', b'\r'))

        self._deliver(b'\r')
        self._deliver(b'a', ('bytes', b'\ra'))
        self._deliver(b'\ra', ('bytes', b'\ra'))

        self._deliver(b'\r')
        self._deliver(
            telnet.IAC + telnet.IAC + b'x', ('bytes', b'\r' + telnet.IAC + b'x'))

        A carriage return only puts the protocol into the newline state.  A
        linefeed in the newline state causes just the newline to be
        delivered.  A nul in the newline state causes a carriage return to
        be delivered.  An IAC in the newline state causes a carriage return
        to be delivered and puts the protocol into the escaped state.
        Anything else causes a carriage return and that thing to be
        delivered.
        
stackoverflow/venv/lib/python3.6/site-packages/twisted/conch/test/test_telnet.py