Don't think you need to check if 'user_data' exists.

```
return user.user_data.get('role', None) == CONFIG['pi_role']
```