use six.string_types instead of basestring for python3 compatibility