Fixing isisntance check for strings depending on python 2 or 3 version