replaced some instances of basestring with six.string_types