def inputcooker(self):
try:<EOL><INDENT>while True:<EOL><INDENT>c = self._inputcooker_getc()<EOL>if not self.iacseq:<EOL><INDENT>if c == IAC:<EOL><INDENT>self.iacseq += c<EOL>continue<EOL><DEDENT>elif c == chr(<NUM_LIT>) and not(self.sb):<EOL><INDENT>c2 = self._inputcooker_getc(block=False)<EOL>if c2 == theNULL or c2 == '<STR_LIT>':<EOL><INDENT>c = chr(<NUM_LIT:10>)<EOL><DEDENT>elif c2 == chr(<NUM_LIT:10>):<EOL><INDENT>c = c2<EOL><DEDENT>else:<EOL><INDENT>self._inputcooker_ungetc(c2)<EOL>c = chr(<NUM_LIT:10>)<EOL><DEDENT><DEDENT>elif c in [x[<NUM_LIT:0>] for x in self.ESCSEQ.keys()]:<EOL><INDENT>'<STR_LIT>'<EOL>codes = c<EOL>for keyseq in self.ESCSEQ.keys():<EOL><INDENT>if len(keyseq) == <NUM_LIT:0>:<EOL><INDENT>continue<EOL><DEDENT>while codes == keyseq[:len(codes)] and len(codes) <= keyseq:<EOL><INDENT>if codes == keyseq:<EOL><INDENT>c = self.ESCSEQ[keyseq]<EOL>break<EOL><DEDENT>codes = codes + self._inputcooker_getc()<EOL><DEDENT>if codes == keyseq:<EOL><INDENT>break<EOL><DEDENT>self._inputcooker_ungetc(codes[<NUM_LIT:1>:])<EOL>codes = codes[<NUM_LIT:0>]<EOL><DEDENT><DEDENT>self._inputcooker_store(c)<EOL><DEDENT>elif len(self.iacseq) == <NUM_LIT:1>:<EOL><INDENT>'<STR_LIT>'<EOL>if c in (DO, DONT, WILL, WONT):<EOL><INDENT>self.iacseq += c<EOL>continue<EOL><DEDENT>self.iacseq = '<STR_LIT>'<EOL>if c == IAC:<EOL><INDENT>self._inputcooker_store(c)<EOL><DEDENT>else:<EOL><INDENT>if c == SB: <EOL><INDENT>self.sb = <NUM_LIT:1><EOL>self.sbdataq = '<STR_LIT>'<EOL><DEDENT>elif c == SE: <EOL><INDENT>self.sb = <NUM_LIT:0><EOL><DEDENT>self.options_handler(self.sock, c, NOOPT)<EOL><DEDENT><DEDENT>elif len(self.iacseq) == <NUM_LIT:2>:<EOL><INDENT>cmd = self.iacseq[<NUM_LIT:1>]<EOL>self.iacseq = '<STR_LIT>'<EOL>if cmd in (DO, DONT, WILL, WONT):<EOL><INDENT>self.options_handler(self.sock, cmd, c)<EOL><DEDENT><DEDENT><DEDENT><DEDENT>except (EOFError, socket.error):<EOL><INDENT>pass<EOL><DEDENT>
Input Cooker - Transfer from raw queue to cooked queue.

        Set self.eof when connection is closed.  Don't block unless in
        the midst of an IAC sequence.