<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def loop(self):
 """ Inner loop for interactive mode. Do not call directly. """

        while True:
            with self.setup_readline():
                try:
                    line = input(self.prompt)
                except EOFError:
                    _vprinterr('^D')
                    break
                except KeyboardInterrupt:
                    _vprinterr('^C')
                    continue
            if not line.strip():
                continue
            try:
                cmd, args = self.cmd_split(line)
            except KeyError as e:
                _vprinterr('<red>Invalid command: %s</red>' % e)
                continue
            try:
                cmd(argv=args)
            except SessionExit:
                break
            except SystemExit as e:
                pass