<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def delete_source(self, name, save_template=True, delete_source_map=False, build_fixed_wts=True, **kwargs):
 """Delete a source from the ROI model. Parameters name : str Source name. save_template : bool Keep the SpatialMap FITS template associated with this source. delete_source_map : bool Delete the source map associated with this source from the source maps file. Returns ------- src : `~fermipy.roi_model.Model` The deleted source object. """


        if not self.roi.has_source(name):
            self.logger.error('No source with name: %s', name)
            return

        loglevel = kwargs.pop('loglevel', self.loglevel)

        self.logger.log(loglevel, 'Deleting source %s', name)

        # STs require a source to be freed before deletion
        if self.like is not None:
            self.free_norm(name, loglevel=logging.DEBUG)

        for c in self.components:
            c.delete_source(name, save_template=save_template,
                            delete_source_map=delete_source_map,
                            build_fixed_wts=build_fixed_wts)

        src = self.roi.get_source_by_name(name)
        self.roi.delete_sources([src])
        if self.like is not None:
            self.like.model = self.like.components[0].model
            self._update_roi()
        return src