basestring is not compatible with Python 3, use compat module instead.