def METHOD_NAME(self, settings):
    """
    Adds a new template.
    :param settings: template settings
    :returns: Template object
    """
    template_id = settings.get("template_id", "")
    if template_id in self._templates:
        raise aiohttp.web.HTTPConflict(text="Template ID '{}' already exists".format(template_id))
    else:
        template_id = settings.setdefault("template_id", str(uuid.uuid4()))
    try:
        template = Template(template_id, settings)
    except jsonschema.ValidationError as e:
        message = "JSON schema error adding template with JSON data '{}': {}".format(settings, e.message)
        raise aiohttp.web.HTTPBadRequest(text=message)
    from . import Controller
    Controller.instance().check_can_write_config()
    self._templates[template.id] = template
    Controller.instance().save()
    Controller.instance().notification.controller_emit("template.created", template.__json__())
    return template