def _write_key_to_regedit_windows(self, key_hex: str) -> None:
        """
        Writes the key to the Windows registry with windows UAC prompt.
        """
        from winreg import ConnectRegistry, OpenKey, QueryValue, HKEY_LOCAL_MACHINE

        value_type = 'REG_SZ'
        command = f'add "{self.keyfile_windows}" /ve /t {value_type} /d "{key_hex}" /f'

        self._run_win_regedit_as_admin(command)

        # check if the key was written correctly
        with ConnectRegistry(None, HKEY_LOCAL_MACHINE) as hkey:
            with OpenKey(hkey, r'SOFTWARE\Electrum') as key:
                assert key_hex == QueryValue(key, 'PluginsKey'), "incorrect registry key value"
        self.logger.debug(f'key saved successfully to {self.keyfile_windows}')

        Writes the key to the Windows registry with windows UAC prompt.
        
electrum/plugin.py