Fix missing basestring in Python 3