def isString(s):
 try:
  return (isinstance(s, unicode) or isintance(s, basestring))
 except NameError:
  return isinstance(s, str)

def isString ( s ) : try : return ( isinstance ( s , unicode ) or isintance ( s , basestring ) ) except NameError : return isinstance ( s , str )
convenience method that works with all 2 .