def _key_exists(hive, key, use_32bit_registry=False):
 if PY2:
  local_hive = _mbcs_to_unicode(hive)
  local_key = _unicode_to_mbcs(key)
 else:
  local_hive = hive
  local_key = key
 registry = Registry()
 hkey = registry.hkeys[local_hive]
 access_mask = registry.registry_32[use_32bit_registry]
 try:
  handle = _winreg.OpenKey(hkey, local_key, 0, access_mask)
  _winreg.CloseKey(handle)
  return True
 except WindowsError:
  return False

def _key_exists ( hive , key , use_32bit_registry = False ) : if PY2 : local_hive = _mbcs_to_unicode ( hive ) local_key = _unicode_to_mbcs ( key ) else : local_hive = hive local_key = key registry = Registry ( ) hkey = registry . hkeys [ local_hive ] access_mask = registry . registry_32 [ use_32bit_registry ] try : handle = _winreg . OpenKey ( hkey , local_key , 0 , access_mask ) _winreg . CloseKey ( handle ) return True except WindowsError : return False
check that the key is found in the registry .