Python Inner Function Modify Outer Variable Decelerations Management