def find_vc_pdir(msvc_version):
    """Try to find the product directory for the given
    version.

    Note
    ----
    If for some reason the requested version could not be found, an
    exception which inherits from VisualCException will be raised."""
    base = _winreg.HKEY_LOCAL_MACHINE
    root = 'Software\\'
    if is_win64():
        root = root + 'Wow6432Node\\'
    try:
        hkeys = _VCVER_TO_PRODUCT_DIR[msvc_version]
    except KeyError:
        #debug("Unknown version of MSVC: %s" % msvc_version)
        raise ValueError("Unknown version %s" % msvc_version)

    for key in hkeys:
        key = root + key
        comps = read_value(key)
        if comps is not None:
            if os.path.exists(comps):
                return comps
            else:
                raise ValueError("registry dir %s not found on the filesystem" % comps)
    return None
dataset/ETHPy150Open cournape/Bento/bento/private/_yaku/yaku/tools/msvc.py/find_vc_pdir/original