def METHOD_NAME(path):
    root_dir_signs = set(["include", "Include", "inc", "Inc", "src", "Src"])
    root_file_signs = set(
        [
            "conanfile.py",  # Conan-based library
            "CMakeLists.txt",  # CMake-based library
        ]
    )
    for root, dirs, files in os.walk(path):
        if not files and len(dirs) == 1:
            continue
        if set(root_dir_signs) & set(dirs):
            return root
        if set(root_file_signs) & set(files):
            return root
        for fname in files:
            if fname.endswith((".c", ".cpp", ".h", ".hpp", ".S")):
                return root
    return path