code: def __check_command_completion(self, testsemicolon=True):
          
          if not self.__curcommand.iscomplete():
              return True
  
          ctype = self.__curcommand.get_type()
          if ctype == "action" or \
                  (ctype == "control" and
                   not self.__curcommand.accept_children):
              if testsemicolon:
                  self.__set_expected("semicolon")
              return True
  
          while self.__curcommand.parent:
              cmd = self.__curcommand
              self.__curcommand = self.__curcommand.parent
              if self.__curcommand.get_type() in ["control", "test"]:
                  if self.__curcommand.iscomplete():
                      if self.__curcommand.get_type() == "control":
                          break
                      continue
                  if not self.__curcommand.check_next_arg("test", cmd, add=False):
                      return False
                  if not self.__curcommand.iscomplete():
                      if self.__curcommand.variable_args_nb:
                          self.__set_expected("comma", "right_parenthesis")
                      break
  
          return True
docs: Check for command(s) completion
  
          This function should be called each time a new argument is
          seen by the parser in order to check a command is complete. As
          not only one command can be ended when receiving a new
          argument (nested commands case), we apply the same work to
          parent commands.
  
          :param testsemicolon: if True, indicates that the next
          expected token must be a semicolon (for commands that need one)
          :return: True if command is
          considered as complete, False otherwise.