<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def generate_cmd_string(self, cmd, *args, **kwargs):
 """ for any generate_cmd_string doesn't written as public method of terraform examples: 1. call import command, ref to https://www.terraform.io/docs/commands/import.html --> generate_cmd_string call: terraform import -input=true aws_instance.foo i-abcd1234 --> python call: tf.generate_cmd_string('import', 'aws_instance.foo', 'i-abcd1234', input=True) 2. call apply command, --> generate_cmd_string call: terraform apply -var='a=b' -var='c=d' -no-color the_folder --> python call: tf.generate_cmd_string('apply', the_folder, no_color=IsFlagged, var={'a':'b', 'c':'d'}) :param cmd: command and sub-command of terraform, seperated with space refer to https://www.terraform.io/docs/commands/index.html :param args: arguments of a command :param kwargs: same as kwags in method 'cmd' :return: string of valid terraform command """

        cmds = cmd.split()
        cmds = [self.terraform_bin_path] + cmds

        for option, value in kwargs.items():
            if '_' in option:
                option = option.replace('_', '-')

            if type(value) is list:
                for sub_v in value:
                    cmds += ['-{k}={v}'.format(k=option, v=sub_v)]
                continue

            if type(value) is dict:
                if 'backend-config' in option:
                    for bk, bv in value.items():
                        cmds += ['-backend-config={k}={v}'.format(k=bk, v=bv)]
                    continue

                # since map type sent in string won't work, create temp var file for
                # variables, and clean it up later
                else:
                    filename = self.temp_var_files.create(value)
                    cmds += ['-var-file={0}'.format(filename)]
                    continue

            # simple flag,
            if value is IsFlagged:
                cmds += ['-{k}'.format(k=option)]
                continue

            if value is None or value is IsNotFlagged:
                continue

            if type(value) is bool:
                value = 'true' if value else 'false'

            cmds += ['-{k}={v}'.format(k=option, v=value)]

        cmds += args
        return cmds