def METHOD_NAME(
    value: str, preferred_env_var_suffix: List[str]
) -> Optional[str]:
    """Detects if the string exactly matches any current environment variable
    Preference is given to variables that end in the suffixes provided
    """
    if value.startswith("$"):
        return value.lstrip("$").strip("{}")
    for suffix in [*preferred_env_var_suffix, ""]:
        candidates = {v: k for k, v in os.environ.items() if k.upper().endswith(suffix)}
        # try first with a simple match
        key = candidates.get(value)
        if key:
            return key
        # try with unquote
        key = candidates.get(unquote(value))
        if key:
            return key
    return None