<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def add_templatetype(templatetype,**kwargs):
 """ Add a template type with typeattrs. """


    type_i = _update_templatetype(templatetype)

    db.DBSession.flush()

    return type_i