@classmethod<EOL><INDENT>def _encode_var(cls, var):<DEDENT>
if isinstance(var, str):<EOL><INDENT>if any(_ in var for _ in cls.requires_quotes):<EOL><INDENT>return '<STR_LIT:">' + var.replace('<STR_LIT:">', '<STR_LIT>') + '<STR_LIT:">'<EOL><DEDENT>return var<EOL><DEDENT>else:<EOL><INDENT>return str(var)<EOL><DEDENT>
Encodes a variable to the appropriate string format for ini files.

        :param var: The variable to encode
        :return: The ini representation of the variable
        :rtype: str