Python: remove driver for deleted shapekey

I'm trying to delete shape key drivers using Python, to clean up scenes. However, I cannot delete some drivers for previously deleted shapekeys:

driver_data_path = bpy.context.object.data.shape_keys.animation_data.drivers[0].data_path
bpy.context.object.data.shape_keys.animation_data.driver_remove(driver_data_path)


brings up this error:

Traceback (most recent call last):
File "<blender_console>", line 1, in <module>

What I understand is that the data_path is an rna path, which is changed to key_blocks["..."].value when the shapekey is deleted. But then it cannot be found by driver_remove()...
• Seems to be a bug. bpy_struct.driver_remove should not rely on the existence of data_path or the removal of a key_block should also delete related drivers. The data_path attribute of the driver is not read-only by the way. – pink vertex Aug 1 '14 at 13:49