Still think the `if else` is redundant since you could just return the result of the if:

`return 'user_data' in user and user.user_data['role'] in [CONFIG['pi_role']]`