PWM fan speed control python script according to cpu temperature

I write a python script to control pwm fan speed according to the cpu temperature. The control is very simple: When the temperature is higher than a gate temperature(for example 65°C), the fan speed will get increased. When the temperature is lower than the gate temperature, the fan speed will get decreased.
Before using this script, you have to initialize your pwm fan according to this wiki page: https://wiki.radxa.com/Rock3/Debian#Control_PWM_Fan
Control script source: https://gist.github.com/amazingfate/38b12841d8a79e06771a7ba8013372ae
You can create a systemd service to run this script.