Use six.string_types instead of basestring