Wouldn't the following be clearer and possibly more future-proof? (here and in line 111 as well)

```python
value = mark_for_escaping(value) # from django.util.safestring
if isinstance(value, EscapeData):
    return escape(value)
```