def get_valid_user_by_email(email):
    """
    Return user instance
    """
    user = get_user(email)
    if user:
        if user.valid is False:
            return Err("user not valid")
        return Ok(user)
    return Err("user not exists")
def get_valid_user_by_email ( email ) : user = get_user ( email ) if user : if user . valid is False : return Err ( "user not valid" ) return Ok ( user ) return Err ( "user not exists" )
Return user instance