def cmdloop(self, intro=None):
self.preloop()<EOL>if self.use_rawinput and self.completekey:<EOL><INDENT>try:<EOL><INDENT>import readline<EOL>self.old_completer = readline.get_completer()<EOL>readline.set_completer(self.complete)<EOL>readline.parse_and_bind(self.completekey + "<STR_LIT>")<EOL><DEDENT>except ImportError:<EOL><INDENT>pass<EOL><DEDENT><DEDENT>try:<EOL><INDENT>if intro is not None:<EOL><INDENT>self.intro = intro<EOL><DEDENT>if self.intro:<EOL><INDENT>self.stdout.write(str(self.intro) + "<STR_LIT:\n>")<EOL><DEDENT>stop = None<EOL>while not stop:<EOL><INDENT>if self.cmdqueue:<EOL><INDENT>line = self.cmdqueue.pop(<NUM_LIT:0>)<EOL><DEDENT>else:<EOL><INDENT>if self.use_rawinput:<EOL><INDENT>try:<EOL><INDENT>line = input(self.prompt)<EOL><DEDENT>except EOFError:<EOL><INDENT>line = '<STR_LIT>'<EOL><DEDENT><DEDENT>else:<EOL><INDENT>self.stdout.write(self.prompt)<EOL>self.stdout.flush()<EOL>line = self.stdin.readline()<EOL>if not len(line):<EOL><INDENT>line = '<STR_LIT>'<EOL><DEDENT>else:<EOL><INDENT>line = line.rstrip('<STR_LIT:\r\n>')<EOL><DEDENT><DEDENT><DEDENT>line = self.precmd(line)<EOL>stop = self.onecmd(line)<EOL>stop = self.postcmd(stop, line)<EOL><DEDENT>self.postloop()<EOL><DEDENT>finally:<EOL><INDENT>if self.use_rawinput and self.completekey:<EOL><INDENT>try:<EOL><INDENT>import readline<EOL>readline.set_completer(self.old_completer)<EOL><DEDENT>except ImportError:<EOL><INDENT>pass<EOL><DEDENT><DEDENT><DEDENT>
Repeatedly issue a prompt, accept input, parse an initial prefix
        off the received input, and dispatch to action methods, passing them
        the remainder of the line as argument.