<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(self, template_name):
 """Delete a template"""

        template = db.Template.find_one(template_name=template_name)
        if not template:
            return self.make_response('No such template found', HTTP.NOT_FOUND)

        db.session.delete(template)
        db.session.commit()
        auditlog(event='template.delete', actor=session['user'].username, data={'template_name': template_name})

        return self.make_response({
            'message': 'Template has been deleted',
            'templateName': template_name
        })