def get_xdg_dir():
env = os.environ<EOL>if os.name == '<STR_LIT>' and sys.platform != '<STR_LIT>':<EOL><INDENT>xdg = env.get("<STR_LIT>", None) or os.path.join(get_home_dir(), '<STR_LIT>')<EOL>if xdg and _writable_dir(xdg):<EOL><INDENT>return py3compat.cast_unicode(xdg, fs_encoding)<EOL><DEDENT><DEDENT>return None<EOL>
Return the XDG_CONFIG_HOME, if it is defined and exists, else None.

    This is only for non-OS X posix (Linux,Unix,etc.) systems.