Python Assign Function To Variable Frequency