Fix for missing basestring in Python 3