You should catch a more specific exception here than just Exception, maybe a TypeError?

Alternatively, you could shorten this up using `callable` and `list`:

```python
urls = list(site_url() if callable(site_url) else site_url)
```