Changing a direct scan classes speed based on duration of call

I would like to write a script that monitors the average response time of a given scanclass, and changes the poling rate of the scanclass to be Average response time + 10%.

Does anyone know how i would go about this? Or if there is a way to change a scanclass with a script