Python 3 compatibility using six.string_types instead of basestring

using basestring breaks the library on Python3, this fixes the issue if you are ok with using six