docs: def mainloop(self):
          """ The main loop.
          """
          self.check_for_connection()
  
          # Enter REPL if no args
          if len(self.args) < 1:
              return self.do_repl()
  
          # Check for bad options
          if self.options.repr and self.options.xml:
              self.parser.error("You cannot combine --repr and --xml!")
          if sum([self.options.as_import, self.options.session]) > 1:
              self.parser.error("You cannot combine -i and --session!")
  
          # Dispatch to handlers
          if self.options.as_import:
              self.do_import()
          elif self.options.session:
              self.do_session()
          else:
              self.do_command()
  
          # XMLRPC stats
          self.LOG.debug("XMLRPC stats: %s" % self.open())