def save(self, obj, do_copy=True, version=None):
     is_bundle = False
     if type(obj) == type(SaveBundle(None)):
         is_bundle = True
         save_bundle = obj
         obj = save_bundle.get_primary_obj()
     obj = io.save_to_xml(obj, self._name, version)
     obj.locator = self
     # Only remove the temporaries if save succeeded!
     self.clean_temporaries()
     if is_bundle:
         return SaveBundle(save_bundle.bundle_type, obj)
     return obj
 def save_temporary(self, obj):
     fname = self._find_latest_temporary()
     new_temp_fname = self._next_temporary(fname)
     io.save_to_xml(obj, new_temp_fname)