code: def read_registry(self):
          
          lm = _winreg.ConnectRegistry(None, _winreg.HKEY_LOCAL_MACHINE)
          want_scan = False
          try:
              try:
                  # XP, 2000
                  tcp_params = _winreg.OpenKey(lm,
                                               r'SYSTEM\CurrentControlSet'
                                               r'\Services\Tcpip\Parameters')
                  want_scan = True
              except EnvironmentError:
                  # ME
                  tcp_params = _winreg.OpenKey(lm,
                                               r'SYSTEM\CurrentControlSet'
                                               r'\Services\VxD\MSTCP')
              try:
                  self._config_win32_fromkey(tcp_params)
              finally:
                  tcp_params.Close()
              if want_scan:
                  interfaces = _winreg.OpenKey(lm,
                                               r'SYSTEM\CurrentControlSet'
                                               r'\Services\Tcpip\Parameters'
                                               r'\Interfaces')
                  try:
                      i = 0
                      while True:
                          try:
                              guid = _winreg.EnumKey(interfaces, i)
                              i += 1
                              key = _winreg.OpenKey(interfaces, guid)
                              if not self._win32_is_nic_enabled(lm, guid, key):
                                  continue
                              try:
                                  self._config_win32_fromkey(key)
                              finally:
                                  key.Close()
                          except EnvironmentError:
                              break
                  finally:
                      interfaces.Close()
          finally:
              lm.Close()
docs: Extract resolver configuration from the Windows registry.