code: def appdatadirectory(  ):
      
      if shell:
          # on Win32 and have Win32all extensions, best-case
          return shell_getShellFolder(shellcon.CSIDL_APPDATA)
      if _winreg:
          # on Win32, but no Win32 shell com available, this uses
          # a direct registry access, likely to fail on Win98/Me
          return _winreg_getShellFolder( 'AppData' )
      # okay, what if for some reason _winreg is missing? would we want to allow ctypes?
      ## default case, look for name in environ...
      for name in ['APPDATA', 'HOME']:
          if name in os.environ:
              return os.path.join( os.environ[name], '.config' )
      # well, someone's being naughty, see if we can get ~ to expand to a directory...
      possible = os.path.abspath(os.path.expanduser( '~/.config' ))
      if os.path.exists( possible ):
          return possible
      raise OSError( """Unable to determine user's application-data directory, no ${HOME} or ${APPDATA} in environment""" )
docs: Attempt to retrieve the current user's app-data directory
  
      This is the location where application-specific
      files should be stored.  On *nix systems, this will
      be the ${HOME}/.config directory.  On Win32 systems, it will be
      the "Application Data" directory.  Note that for
      Win32 systems it is normal to create a sub-directory
      for storing data in the Application Data directory.