code: def _delete_test_data(self, root_key, subkeystr="sub_key"):
      key = OpenKey(root_key, test_key_name, 0, KEY_ALL_ACCESS)
      sub_key = OpenKey(key, subkeystr, 0, KEY_ALL_ACCESS)
      # It is not necessary to delete the values before deleting
      # the key (although subkeys must not exist).  We delete them
      # manually just to prove we can :-)
      for value_name, value_data, value_type in test_data:
          DeleteValue(sub_key, value_name)
  
      nkeys, nvalues, since_mod = QueryInfoKey(sub_key)
      self.assertEqual(nkeys, 0, "subkey not empty before delete")
      self.assertEqual(nvalues, 0, "subkey not empty before delete")
      sub_key.Close()
      DeleteKey(key, subkeystr)
  
      try:
          # Shouldn't be able to delete it twice!
          DeleteKey(key, subkeystr)
          self.fail("Deleting the key twice succeeded")
      except OSError:
          pass
      key.Close()
      DeleteKey(root_key, test_key_name)
      # Opening should now fail!
      try:
          key = OpenKey(root_key, test_key_name)
          self.fail("Could open the non-existent key")
      except OSError:  # Use this error name this time
          pass
  
imports: import gc
  import os, sys, errno
  import threading
  import unittest
  from platform import machine, win32_edition
  from test.support import cpython_only, import_helper
  from winreg import *
label_desc: Use image node_id 5 for calling the BaseWinregTests obj's underlying member method code with example usage: obj._delete_test_data(root_key, subkeystr) without return types