There may be better ways to distinguish between a `string` and a `dict` argument (e.g. `hasattr(lookup_view, 'has_key')`).

Doing it the current way, I would at least add a type to the exception (`except TypeError:`), so that exceptions caused by `reverse` (e.g. `NoReverseMatch`) are not caught, since this would set `url` to a `dict` in the exception handler.