def add(self, command):
        """
        Adds a command object.

        If a command with the same name already exists, it will be overridden.

        :param command: A Command object or a dictionary defining the command
        :type command: Command or dict

        :return: The registered command
        :rtype: Command
        """
        if isinstance(command, dict):
            command = Command.from_dict(command)

        command.set_application(self)

        if not command.is_enabled():
            command.set_application(None)

            return

        try:
            command.get_definition()
        except __HOLE__:
            raise Exception(
                'Command class "%s" is not correctly initialized.'
                'You probably forgot to call the parent constructor.'
                % command.__class__.__name__
            )

        self._commands[command.get_name()] = command

        for alias in command.get_aliases():
            self._commands[alias] = command

        return command
dataset/ETHPy150Open sdispater/cleo/cleo/application.py/Application.add