'Remove a command instance from the cmdset.
Args:
cmd (Command or str): Either the Command object to remove
or the key of such a command.'

def remove(self, cmd):

    cmd = self._instantiate(cmd)
    if cmd.key.startswith('__'):
        try:
            ic = self.system_commands.index(cmd)
            del self.system_commands[ic]
        except ValueError:
            pass
    else:
        self.commands = [oldcmd for oldcmd in self.commands if (oldcmd != cmd)]
