def text_string(value, encoding='utf-8'):
 if isinstance(value, bytes):
  return value.decode(encoding)
 return value

def text_string ( value , encoding = 'utf-8' ) : if isinstance ( value , bytes ) : return value . decode ( encoding ) return value
convert a string .