Use six.string_types instead of basestring for python 3 compatibility