def find_python():
    '''
    retrieves the commandline for .py extensions from the registry
    '''
    hKey = _winreg.OpenKey(_winreg.HKEY_CLASSES_ROOT, 
                           r'Python.File\shell\open\command') 
    # get the default value
    value, typ = _winreg.QueryValueEx (hKey, None)
    program = value.split('"')[1]
    if not program.lower().endswith(r'\python.exe'):
        return None
    return os.path.dirname(program)

    retrieves the commandline for .py extensions from the registry
    
recipes/Python/577233_Adding_directory_pythexecutable_system_PATH/recipe-577233.py