code: def is_text(var, allow_none=False):
      
      return isinstance(var, six.text_type) or (var is None and allow_none)
docs: Returns True if var is a unicode text
  
          Result             py-2  py-3
          -----------------  ----- -----
          b'bytes literal'   False False
           'string literal'  False True
          u'unicode literal' True  True
  
          Also works with the corresponding numpy types.