replace isinstance(o, str) with isinstance(o, (str, unicode))