<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_by_username(cls, username):
 """Get profile by username. :param username: A username to query for (case insensitive). """

        return cls.query.filter(
            UserProfile._username == username.lower()
        ).one()