<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_perm(perm,**kwargs):
 """ Add a permission """

    #check_perm(kwargs.get('user_id'), 'add_perm')
    perm_i = Perm(name=perm.name, code=perm.code)
    db.DBSession.add(perm_i)
    db.DBSession.flush()

    return perm_i