How to change robot max speed with input?


I’m trying to find info how to change speeds during runtime.
I want to reduce robot’s max speed to 80 deg/s when input from safety scanner is TRUE.

My lead is to somehow write a Python script in the modelling tab.

Could someone help me a bit? Robot model is ABB CRB15000 GoFa10