docs: def _encode_var(cls, var):
          """ 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
          """
  
          if isinstance(var, str):
              if any(_ in var for _ in cls.requires_quotes):
                  # NOTE: quoted strings should just use '"' according to the spec
                  return '"' + var.replace('"', '\\"') + '"'
              return var
          else:
              return str(var)