Python 2 and 3 compat

Hi,

just a small change to handle `basestring` / `str` issue in Python2/3. 

If you aim for a different strategy for 2/3 compat, let me know, I'll change it.