How to change the handle_type of a keyframe I've just inserted?
I figured out a way to do it but in my opinion it's not ideal:

keyframe = sp.id_data.animation_data.action.fcurves[-1].keyframe_points[-1]
keyframe.handle_left_type = 'VECTOR'
keyframe.handle_right_type = 'VECTOR'


It's not ideal because the action might have other fcurves but it solves my case because I know it doesn't for my particular problem.