def remove(self, cmdset=None, default_cmdset=False):
        """
        Remove a cmdset from the  handler.

        Args:
            cmdset (CommandSet or str, optional): This can can be supplied either as a cmdset-key,
                an instance of the CmdSet or a python path to the cmdset.
                If no key is given, the last cmdset in the stack is
                removed. Whenever the cmdset_stack changes, the cmdset is
                updated. If default_cmdset is set, this argument is ignored.
            default_cmdset (bool, optional): If set, this will remove the
                default cmdset (at the bottom of the stack).

        """
        if default_cmdset:
            # remove the default cmdset only
            if self.cmdset_stack:
                cmdset = self.cmdset_stack[0]
                if cmdset.permanent:
                    storage = self.obj.cmdset_storage or [""]
                    storage[0] = ""
                    self.obj.cmdset_storage = storage
                self.cmdset_stack[0] = _EmptyCmdSet(cmdsetobj=self.obj)
            else:
                self.cmdset_stack = [_EmptyCmdSet(cmdsetobj=self.obj)]
            self.update()
            return

        if 2 < len(self.cmdset_stack):
            # don't allow deleting default cmdsets here.
            return

        if not cmdset:
            # remove the last one in the stack
            cmdset = self.cmdset_stack.pop()
            if cmdset.permanent:
                storage = self.obj.cmdset_storage
                storage.pop()
                self.obj.cmdset_storage = storage
        else:
            # try it as a callable
            if callable(cmdset) and hasattr(cmdset, 'path'):
                delcmdsets = [cset for cset in self.cmdset_stack[1:]
                              if cset.path == cmdset.path]
            else:
                # try it as a path or key
                delcmdsets = [cset for cset in self.cmdset_stack[1:]
                              if cset.path == cmdset or cset.key == cmdset]
            storage = []

            if any(cset.permanent for cset in delcmdsets):
                # only hit database if there's need to
                storage = self.obj.cmdset_storage
                updated = False
                for cset in delcmdsets:
                    if cset.permanent:
                        try:
                            storage.remove(cset.path)
                            updated = True
                        except ValueError:
                            pass
                if updated:
                    self.obj.cmdset_storage = storage
            for cset in delcmdsets:
                # clean the in-memory stack
                try:
                    self.cmdset_stack.remove(cset)
                except ValueError:
                    pass
        # re-sync the cmdsethandler.
        self.update()
    # legacy alias
dataset/ETHPy150Open evennia/evennia/evennia/commands/cmdsethandler.py/CmdSetHandler.remove/swapped operands of `<`