code: def serve_forever(self, banner=None):
          
          if banner:
              print(banner)
          while True:
              try:
                  self.interact()
              except KeyboardInterrupt:  # program interrupted by the user
                  print  # do not print on the same line as ^C
                  pass
              except SystemExit:  # exit from the interpreter
                  break
docs: Handle one interaction at a time until shutdown.
  
          :param banner: (optional) the banner to print before the first
                         interaction. Defaults to ``None``.