Very minor point, but you don't need to use `update()`, you could just do:

```python
meta_dict = {'Shib-Identity-Provider': IDP,
             'REMOTE_USER': REMOTE_USER}
if mail is not None:
    meta_dict['mail'] = mail
if given_name is not None:
    meta_dict['givenName'] = given_name
if surname is not None:
    meta_dict['sn'] = surname
```