Python 3 compatibility - Replace usage of basestring with six.string_types.