def general_command(self, worksheet_uuid, command):
        """
        Executes an arbitrary CLI command with |worksheet_uuid| as the current worksheet.
        Basically, all CLI functionality should go through this command.
        The method currently intercepts stdout/stderr and returns it back to the user.
        """
        # Tokenize
        if isinstance(command, basestring):
            args = shlex.split(command)
        else:
            args = list(command)

        # Ensure command always starts with 'cl'
        if args[0] == 'cl':
            args = args[1:]

        cli, output_buffer = self._create_cli(worksheet_uuid)
        exception = None
        structured_result = None
        try:
            structured_result = cli.do_command(args)
        except SystemExit:  # as exitcode:
            # this should not happen under normal circumstances
            pass
        except BaseException as e:
            exception = str(e)

        output_str = output_buffer.getvalue()
        output_buffer.close()

        return {
            'structured_result': structured_result,
            'output': output_str,
            'exception': exception
        }
dataset/ETHPy150Open codalab/codalab-cli/codalab/rest/legacy.py/BundleService.general_command/original