docs: def check_next_arg(self, atype, avalue, add=True, check_extension=True):
          """Argument validity checking
  
          This method is usually used by the parser to check if detected
          argument is allowed for this command.
  
          We make a distinction between required and optional
          arguments. Optional (or tagged) arguments can be provided
          unordered but not the required ones.
  
          A special handling is also done for arguments that require an
          argument (example: the :comparator argument expects a string
          argument).
  
          The "testlist" type is checked separately as we can't know in
          advance how many arguments will be provided.
  
          If the argument is incorrect, the method raises the
          appropriate exception, or return False to let the parser
          handle the exception.
  
          :param atype: the argument's type
          :param avalue: the argument's value
          :param add: indicates if this argument should be recorded on success
          :param check_extension: raise ExtensionNotLoaded if extension not
                                  loaded
          :return: True on success, False otherwise
          """
          if not self.has_arguments():
              return False
          if self.iscomplete(atype, avalue):
              return False
  
          if self.curarg is not None and "extra_arg" in self.curarg:
              condition = (
                  atype in self.curarg["extra_arg"]["type"] and
                  ("values" not in self.curarg["extra_arg"] or
                   avalue in self.curarg["extra_arg"]["values"])
              )
              if condition:
                  if add:
                      self.extra_arguments[self.curarg["name"]] = avalue
                  self.curarg = None
                  return True
              raise BadValue(self.curarg["name"], avalue)
  
          failed = False
          pos = self.nextargpos
          while pos < len(self.args_definition):
              curarg = self.args_definition[pos]
              if curarg.get("required", False):
                  if curarg["type"] == ["testlist"]:
                      if atype != "test":
                          failed = True
                      elif add:
                          if not curarg["name"] in self.arguments:
                              self.arguments[curarg["name"]] = []
                          self.arguments[curarg["name"]] += [avalue]
                  elif not self.__is_valid_type(atype, curarg["type"]) or \
                          not self.__is_valid_value_for_arg(
                              curarg, avalue, check_extension):
                      failed = True
                  else:
                      self.curarg = curarg
                      self.rargs_cnt += 1
                      self.nextargpos = pos + 1
                      if add:
                          self.arguments[curarg["name"]] = avalue
                  break
  
              condition = (
                  atype in curarg["type"] and
                  self.__is_valid_value_for_arg(curarg, avalue, check_extension)
              )
              if condition:
                  ext = curarg.get("extension")
                  condition = (
                      check_extension and ext and
                      ext not in RequireCommand.loaded_extensions)
                  if condition:
                      raise ExtensionNotLoaded(ext)
                  condition = (
                      "extra_arg" in curarg and
                      ("valid_for" not in curarg["extra_arg"] or
                       avalue in curarg["extra_arg"]["valid_for"])
                  )
                  if condition:
                      self.curarg = curarg
                  if add:
                      self.arguments[curarg["name"]] = avalue
                  break
  
              pos += 1
  
          if failed:
              raise BadArgument(self.name, avalue,
                                self.args_definition[pos]["type"])
          return True