raising `AssertionError` is probably not the right thing to do because it will silence assertion errors further down (probably covering a bug). Why not this instead?

```python
if domain != loc.domain:
    return None
```