Use string_types and not basestring
Fix PEP8 formatting