GimpUi.gimpexport
This function should be called by all save_plugins unless they are able to save all image formats GIMP knows about. It takes care of asking the user if she wishes to export the image to a format the save_plugin can handle. It then performs the necessary conversions (e.g. Flatten) on a copy of the image so that the image can be saved without changing the original image.
The capabilities of the save_plugin are specified by combining GimpUi.ExportCapabilities using a bitwise OR.
Make sure you have initialized GTK+ before you call this function as it will most probably have to open a dialog.