I'm not a fan of multiple LDAP calls to do the same thing from a readability perspective. What about some magic on creation of the attrlist? Something like:

```
attrs = []
if config.get('dir_auth_source') != 'dn':
    attrs.append(config['dir_auth_username'])
```

or something otherwise like that.