code: def find_home_directory():
      
      if WINDOWS:
          directory = os.environ.get('APPDATA')
          if not directory:
              directory = os.path.expanduser(r'~\Application Data')
      else:
          # This module isn't available on Windows so we have to import it here.
          import pwd
          # Look up the home directory of the effective user id so we can
          # generate pathnames relative to the home directory.
          entry = pwd.getpwuid(os.getuid())
          directory = entry.pw_dir
      return directory
docs: Look up the home directory of the effective user id.
  
      :returns: The pathname of the home directory (a string).
  
      .. note:: On Windows this uses the ``%APPDATA%`` environment variable (if
                available) and otherwise falls back to ``~/Application Data``.