Scale keyframes for multiple objects with a script I have N objects in a scene and each has baked keyframes on some frame_start, frame_end interval. 

Can anyone help me to write a script to scale keyframes for all of the objects along x axis and set interpolation type to constant. I cannot find an appropriate function to scale that programmatically.

thanks
I found a solution, however it resizes keypoints around arbitrary point.

old_type = bpy.context.area.type
bpy.context.area.type = 'GRAPH_EDITOR'
bpy.ops.graph.interpolation_type(type='CONSTANT')
bpy.context.scene.frame_current = 1
bpy.ops.transform.resize(value=(6, 1, 1))
bpy.context.area.type = old_type