code: def _encode_text(name, value, dummy0, dummy1):
      
      value = _utf_8_encode(value)[0]
      return b"\x02" + name + _PACK_INT(len(value) + 1) + value + b"\x00"
docs: Encode a python unicode (python 2.x) / str (python 3.x).