<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def extend(self, cli_api, command_prefix="", sub_command="", **kwargs):
 """Extends this CLI api with the commands present in the provided cli_api object"""

        if sub_command and command_prefix:
            raise ValueError('It is not currently supported to provide both a command_prefix and sub_command')

        if sub_command:
            self.commands[sub_command] = cli_api
        else:
            for name, command in cli_api.commands.items():
                self.commands["{}{}".format(command_prefix, name)] = command