def auto_cpp_level(compiler: Any) -> str | int:
    """
    Return the max supported C++ std level (17, 14, or 11). Returns latest on Windows.
    """

    if WIN:
        return "latest"

    levels = [17, 14, 11]

    for level in levels:
        if has_flag(compiler, STD_TMPL.format(level)):
            return level

    msg = "Unsupported compiler -- at least C++11 support is needed!"
    raise RuntimeError(msg)

    Return the max supported C++ std level (17, 14, or 11). Returns latest on Windows.
    
deps/pybind11/pybind11/setup_helpers.py