@login_manager.user_loader
def load_user(userid):
    if userid.startswith(u'labmanager_admin::'):
        login = userid.split(u'labmanager_admin::')[1]
        return LabManagerUser.find(login = login)
    if userid.startswith(u'lt_user::'):
        try:
            _, lt_name, login = userid.split('::')
        except __HOLE__:
            print gettext("Invalid format (expected lt_user::lt_name::login)")
            return None
        potential_users = [ user for user in LtUser.all(login = login) if user.lt.name == lt_name ]
        if len(potential_users) == 0:
            return None
        else:
            return potential_users[0]
    return None
dataset/ETHPy150Open gateway4labs/labmanager/labmanager/views/authn.py/load_user