I\'m aware that I can use: isinstance(x, str) in python-3.x but I need to check if something is a string in python-2.x as well. Will isinstance(x, str)
You can get the class of an object by calling object.__class__, so in order to check if object is the default string type:
isinstance(object,"".__class__)
And You can place the following in the top of Your code so that strings enclosed by quotes are in unicode in python 2:
from __future__ import unicode_literals