docs: def run(self):
          """ prepares the api and starts the tornado funcserver """
          self.log_id = 0
  
          # all active websockets and their state
          self.websocks = {}
  
          # all active python interpreter sessions
          self.pysessions = {}
  
          if self.DISABLE_REQUESTS_DEBUG_LOGS:
              disable_requests_debug_logs()
  
          self.threadpool = ThreadPool(self.THREADPOOL_WORKERS)
  
          self.api = None
  
          # tornado app object
          base_handlers = self.prepare_base_handlers()
          handlers = self.prepare_handlers()
          self.template_loader = TemplateLoader([resolve_path(self.TEMPLATE_PATH)])
          _ = self.prepare_template_loader(self.template_loader)
          if _ is not None: self.template_loader = _
  
          shclass = CustomStaticFileHandler
          shclass.PATHS.append(resolve_path(self.STATIC_PATH))
          _ = self.prepare_static_paths(shclass.PATHS)
          if _ is not None: shclass.PATHS = _
  
          self.static_handler_class = shclass
  
          self.nav_tabs = [('Home', '/')]
          if self.args.debug:
              self.nav_tabs += [('Console', '/console'), ('Logs', '/logs')]
          self.nav_tabs = self.prepare_nav_tabs(self.nav_tabs)
  
          settings = {
              'static_path': '<DUMMY-INEXISTENT-PATH>',
              'static_handler_class': self.static_handler_class,
              'template_loader': self.template_loader,
              'compress_response': True,
              'debug': self.args.debug,
          }
  
          all_handlers = handlers + base_handlers
          self.app = self.APP_CLASS(**settings)
          self.app.add_handlers(self.VIRTUAL_HOST, all_handlers)
  
          sys.funcserver = self.app.funcserver = self
  
          self.api = self.prepare_api()
          if self.api is not None and not hasattr(self.api, 'log'):
              self.api.log = self.log
  
          if self.args.port != 0:
              self.app.listen(self.args.port)
  
          tornado.ioloop.IOLoop.instance().start()