code: def convert(self, argument):
      
      if isinstance(argument, str):
        if argument.lower() in ['true', 't', '1']:
          return True
        elif argument.lower() in ['false', 'f', '0']:
          return False
  
      bool_argument = bool(argument)
      if argument == bool_argument:
        # The argument is a valid boolean (True, False, 0, or 1), and not just
        # something that always converts to bool (list, string, int, etc.).
        return bool_argument
  
      raise ValueError('Non-boolean argument to boolean flag', argument)
docs: Converts the argument to a boolean; raise ValueError on errors.