def unicode2bytes(x, encoding='utf-8'):
 if isinstance(x, text_type):
  x = x.encode(encoding)
 return x

def unicode2bytes ( x , encoding = 'utf-8' ) : if isinstance ( x , text_type ) : x = x . encode ( encoding ) return x
convert a unicode string to c{bytes} .