def DeleteRegistryKey(hiveKey, key):
    """ Deletes a registry key -- must be a leaf key or call fails """
    try:
        result = win32api.RegDeleteKey(hiveKey, key)
        return result
    except Exception, e:
        print "DeleteRegistryKey failed:", hiveKey, key, e
    return None
 Deletes a registry key -- must be a leaf key or call fails 
recipes/Python/528896_Simplest_Registry_IO/recipe-528896.py