<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def run(self, instream=sys.stdin):
 """Runs the CLI, reading from sys.stdin by default """

        sys.stdout.write(self.prompt)
        sys.stdout.flush()
        while True:
            line = instream.readline()
            try:
                self.exec_cmd(line)
            except Exception as e:
                self.errfun(e)

            sys.stdout.write(self.prompt)
            sys.stdout.flush()