Instead of adding another conditional, I suggest changing the way this works slightly. In my mind, this is optimal:

```python
config = {'proxy': proxy}
if username and api_key:
    config['auth'] = BasicAuthentication(username, api_key)
return config
```