Correct isinstance of str by basestring

Change isintance(..., str) by isinstance(..., basestring)