<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def get_template(template_id,**kwargs):
 """ Get a specific resource template template, by ID. """

    try:
        tmpl_i = db.DBSession.query(Template).filter(Template.id==template_id).options(joinedload_all('templatetypes.typeattrs.default_dataset.metadata')).one()

        #Load the attributes.
        for tmpltype_i in tmpl_i.templatetypes:
            for typeattr_i in tmpltype_i.typeattrs:
                typeattr_i.attr

        return tmpl_i
    except NoResultFound:
        raise HydraError("Template %s not found"%template_id)