def get_env(name, current=True):
    """
    Return HKCU/HKLM environment variable name and value

    @param      name        name to look for
    @param      current     switch between *HKEY_CURRENT_USER* (True) and *HKEY_LOCAL_MACHINE* (False)
    @return                 tuple (see below)

    For example, get_user_env('PATH') may returns::

        ('Path', u'C:\\Program Files\\Intel\\WiFi\\bin\\')
    """
    import winreg
    root = winreg.HKEY_CURRENT_USER if current else winreg.HKEY_LOCAL_MACHINE
    key = winreg.OpenKey(root, 'Environment')
    for index in range(0, winreg.QueryInfoKey(key)[1]):
        try:
            value = winreg.EnumValue(key, index)
            if value[0].lower() == name.lower():
                return value[0], value[1]
        except Exception:
            break
