<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_user_by_key(app, key):
 """ An SQLAlchemy User getting function. Get a user by public key. :param str key: the public key the user belongs to """

    user = ses.query(um.User).join(um.UserKey).filter(um.UserKey.key==key).first()
    return user