How to control fan speed based on GPU index instead of fan index

AFAIK, this has always been an issue, basing on the fact that there has been no development on the nvml lib for years, also resulting in this:
https://forums.developer.nvidia.com/t/request-gpu-memory-junction-temperature-via-nvidia-smi-or-nvml-api/168346/11