<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_role_by_code(role_code,**kwargs):
 """ Get a role by its code """

    try:
        role = db.DBSession.query(Role).filter(Role.code==role_code).one()
        return role
    except NoResultFound:
        raise ResourceNotFoundError("Role not found (role_code={})".format(role_code))