This is not just pep8 changes then.

To do what you're looking for add 

```
from requests.compat import basestring
```

To the top of the file and just use

```
if isinstance(var, basestring):
```