I try to avoid bare excepts. An alternative:

```
if hasattr(request, 'session'):
    return getattr(request.session, 'session_key', '')
else:
    return ''
```