def deleteRegistryKey(key, sub_key, name):
    """
    A simple function used to delete values in
    the Windows Registry if present. Silently ignores failure 
    if value doesn't exist.
    """
    try:
        key_handle = OpenKey(key, sub_key, 0, KEY_ALL_ACCESS)
    except WindowsError:
        if debug: print 'No such key'
        return
    
    try:
        DeleteValue(key_handle, name) 
    except WindowsError:
        if debug: print "Value doesn't exist"
        return 
        
    CloseKey(key_handle)

    A simple function used to delete values in
    the Windows Registry if present. Silently ignores failure 
    if value doesn't exist.
    
recipes/Python/578200_Set_windows_7_lock_itself_uptimeout_if_no/recipe-578200.py