I working on a script that makes use of running "bpy.ops.paint.image_paint" many times for multiple texture layers. I would like to condense the multiple undo states into one.

Currently I am doing something like this to avoid uselessly creating undo states:

use_global_undo = prefs.edit.use_global_undo
undo_steps = prefs.edit.undo_steps
prefs.edit.undo_steps = 0
prefs.edit.use_global_undo = False

for i in range(someBigNumber):
     brush.texture.image = bpy.data.images[brush_image]
     obj.active_material.paint_active_slot = the_slot

prefs = bpy.context.user_preferences
prefs.edit.undo_steps = undo_steps
prefs.edit.use_global_undo = use_global_undo
This is all in an operator with these options:
bl_options = {'REGISTER', 'UNDO', 'PRESET'}
Is it currently possible in blender to condense all of these image_paint operator calls into one undo?