def utf8_encode(value):
 if isinstance(value, six.text_type):
  return _utf8_encoder(value)[0]
 elif isinstance(value, six.binary_type):
  return value
 else:
  value_cls_name = reflection.get_class_name(value, fully_qualified=False)
  raise TypeError(('value must be basestring, not %s' % value_cls_name))

def utf8_encode ( value ) : if isinstance ( value , six . text_type ) : return _utf8_encoder ( value ) [ 0 ] elif isinstance ( value , six . binary_type ) : return value else : value_cls_name = reflection . get_class_name ( value , fully_qualified = False ) raise TypeError ( ( 'value must be basestring, not %s' % value_cls_name ) )
encode a basestring to utf-8 .