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:
Control script source:
You can create a systemd service to run this script.