Not quite sure what's going on in this line. If I understand what this is getting at, maybe something like this would be simpler?
```
    if url.upper().startswith(relative_url_prefix):
```