you can replace with

```
if not isinstance(s, basestring):
```