Effects of python script are not permanent
All I needed was to add two lines

prevk.handle_right_type = 'FREE'
k.handle_left_type = 'FREE'


The original / default handle types caused a recalculation with the consequences observed once the F-curve was "touched" in any way, and that is expected behaviour.