code: def is_string(val):
      
      try:
          basestring
      except NameError:
          return isinstance(val, str)
      return isinstance(val, basestring)
docs: Determines whether the passed value is a string, safe for 2/3.