docs: def _parse_args(args_list, watcher_plugin_class, health_plugin_class):
      """
      Parse command line arguments and return relevant values in a dict.
  
      Also perform basic sanity checking on some arguments.
  
      If plugin classes have been provided then a callback into those classes is
      used to extend the arguments with plugin-specific options.
  
      Likewise, the sanity checking will then also invoke a callback into the
      plugins, in order to perform a sanity check on the plugin options.
  
      """
      conf = {}
  
      # Setting up the command line argument parser. Note that we pass the
      # complete list of all plugins, so that their parameter can be added to the
      # official parameter handling, the help screen, etc. Some plugins may even
      # add further plugins themselves, but will handle this themselves.
      parser, arglist = _setup_arg_parser(args_list, watcher_plugin_class,
                                          health_plugin_class)
      args            = parser.parse_args(args_list)
  
      # Transcribe argument values into our own dict
      for argname in arglist:
          conf[argname] = getattr(args, argname)
  
      # Sanity checking of arguments. Let the watcher and health-monitor plugin
      # class check their own arguments.
      for plugin_class in [watcher_plugin_class, health_plugin_class]:
          if plugin_class:
              try:
                  plugin_class.check_arguments(conf)
              except ArgsError as e:
                  parser.print_help()
                  raise e
  
      # Sanity checking of other args
      if conf['route_recheck_interval'] < 5 and \
                          conf['route_recheck_interval'] != 0:
          raise ArgsError("route_recheck_interval argument must be either 0 "
                          "or at least 5")
  
      if not 0 < conf['port'] < 65535:
          raise ArgsError("Invalid listen port '%d' for built-in http server." %
                          conf['port'])
  
      if not conf['addr'] == "localhost":
          # Check if a proper address was specified (already raises a suitable
          # ArgsError if not)
          utils.ip_check(conf['addr'])
  
      if conf['ignore_routes']:
          # Parse the list of addresses and CIDRs
          for a in conf['ignore_routes'].split(","):
              a = a.strip()
              a = utils.check_valid_ip_or_cidr(a, return_as_cidr=True)
              CURRENT_STATE.ignore_routes.append(a)
  
      # Store a reference to the config dict in the current state
      CURRENT_STATE.conf = conf
  
      return conf