def remove_command(self, name):
command = self.all_commands.pop(name, None)<EOL>if command is None:<EOL><INDENT>return None<EOL><DEDENT>if name in command.aliases:<EOL><INDENT>return command<EOL><DEDENT>for alias in command.aliases:<EOL><INDENT>self.all_commands.pop(alias, None)<EOL><DEDENT>return command<EOL>
Remove a :class:`.Command` or subclasses from the internal list
        of commands.

        This could also be used as a way to remove aliases.

        Parameters
        -----------
        name: :class:`str`
            The name of the command to remove.

        Returns
        --------
        :class:`.Command` or subclass
            The command that was removed. If the name is not valid then
            `None` is returned instead.