code: def get_shell_folder (name):
      
      try:
          import _winreg as winreg
      except ImportError:
          import winreg
      lm = winreg.ConnectRegistry(None, winreg.HKEY_CURRENT_USER)
      try:
          key = winreg.OpenKey(lm, r"Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders")
          try:
              return winreg.QueryValueEx(key, name)[0]
          finally:
              key.Close()
      finally:
          lm.Close()
docs: Get Windows Shell Folder locations from the registry.