def convert_item_to_command_line_arg(self, action, key, value):
        args = []
        if action is None:
            command_line_key = \
                self.get_command_line_key_for_unknown_config_file_setting(key)
        else:
            command_line_key = action.option_strings[-1]

        # handle boolean value
        if action is not None and type(action) in ACTION_TYPES_THAT_DONT_NEED_A_VALUE:
            if value.lower() in ("true", "false", "yes", "no"):
                args.append( command_line_key )
            else:
                self.error("Unexpected value for %s: '%s'. Expecting 'true', "
                           "'false', 'yes', or 'no'" % (key, value))
        elif type(value) == list:
            if action is not None and type(action) != argparse._AppendAction:
                    self.error(("%s can't be set to a list '%s' unless its "
                        "action type is changed to 'append'") % (key, value))
            for list_elem in value:
                args.append( command_line_key )
                args.append( str(list_elem) )
        elif type(value) == str:
            args.append( command_line_key )
            args.append( value )
        else:
            raise ValueError("Unexpected value type %s for value: %s" % (
                type(value), value))

        return args
Converts a config file or env var key + value to a list of
dataset/ETHPy150Open bw2/ConfigArgParse/configargparse.py/ArgumentParser.convert_item_to_command_line_arg