docs: def main(cls):
          """
          Command-line entry point for running a PySOA server. The chain of method calls is as follows::
  
              cls.main
                |
                -> cls.initialize => new_cls
                -> new_cls.__init__ => self
                -> self.run
                    |
                    -> self.setup
                    -> loop: self.handle_next_request while not self.shutting_down
                              |
                              -> transport.receive_request_message
                              -> self.perform_idle_actions (if no request)
                              -> self.perform_pre_request_actions
                              -> self.process_job
                                  |
                                  -> middleware(self.execute_job)
                              -> transport.send_response_message
                              -> self.perform_post_request_actions
          """
          parser = argparse.ArgumentParser(
              description='Server for the {} SOA service'.format(cls.service_name),
          )
          parser.add_argument(
              '-d', '--daemon',
              action='store_true',
              help='run the server process as a daemon',
          )
          if not cls.use_django:
              # If Django mode is turned on, we use the Django settings framework to get our settings, so the caller
              # needs to set DJANGO_SETTINGS_MODULE. Otherwise, the caller must pass in the -s/--settings argument.
              parser.add_argument(
                  '-s', '--settings',
                  help='The settings module to use',
                  required=True,
              )
          cmd_options, _ = parser.parse_known_args(sys.argv[1:])
  
          # Load settings from the given file (or use Django and grab from its settings)
          if cls.use_django:
              # noinspection PyUnresolvedReferences
              if not django_settings:
                  raise ImportError(
                      'Could not import Django. You must install Django if you enable Django support in your service.'
                  )
              try:
                  settings = cls.settings_class(django_settings.SOA_SERVER_SETTINGS)
              except AttributeError:
                  raise ValueError('Cannot find `SOA_SERVER_SETTINGS` in the Django settings.')
          else:
              try:
                  settings_module = importlib.import_module(cmd_options.settings)
              except ImportError as e:
                  raise ValueError('Cannot import settings module `%s`: %s' % (cmd_options.settings, e))
              try:
                  settings_dict = getattr(settings_module, 'SOA_SERVER_SETTINGS')
              except AttributeError:
                  try:
                      settings_dict = getattr(settings_module, 'settings')
                  except AttributeError:
                      raise ValueError(
                          "Cannot find `SOA_SERVER_SETTINGS` or `settings` variable in settings module `{}`.".format(
                              cmd_options.settings,
                          )
                      )
              settings = cls.settings_class(settings_dict)
  
          PySOALogContextFilter.set_service_name(cls.service_name)
  
          # Set up logging
          logging.config.dictConfig(settings['logging'])
  
          # Optionally daemonize
          if cmd_options.daemon:
              pid = os.fork()
              if pid > 0:
                  print('PID={}'.format(pid))
                  sys.exit()
  
          # Set up server and signal handling
          server = cls.initialize(settings)(settings)
  
          # Start server event loop
          server.run()