def utf8(value):
 if ((value is None) or isinstance(value, six.binary_type)):
  return value
 if (not isinstance(value, six.text_type)):
  value = six.text_type(value)
 return value.encode('utf-8')

def utf8 ( value ) : if ( ( value is None ) or isinstance ( value , six . binary_type ) ) : return value if ( not isinstance ( value , six . text_type ) ) : value = six . text_type ( value ) return value . encode ( 'utf-8' )
converts a string argument to a byte string .