Potentiometer Function In Python