@classmethod
def get_by_name(cls, context, name):
    """Find a deploy template based on its name.

        :param context: security context. NOTE: This should only
                        be used internally by the indirection_api.
                        Unfortunately, RPC requires context as the first
                        argument, even though we don't use it.
                        A context should be set when instantiating the
                        object, e.g.: DeployTemplate(context).
        :param name: The name of a deploy template.
        :raises: DeployTemplateNotFound if the deploy template no longer
            appears in the database.
        :returns: a :class:`DeployTemplate` object.
        """
    db_template = cls.dbapi.get_deploy_template_by_name(name)
    template = cls._from_db_object(context, cls(), db_template)
    return template
