def unicode2utf8(arg):
 if (PY2 and isinstance(arg, unicode)):
  return arg.encode('utf-8')
 return arg

def unicode2utf8 ( arg ) : if ( PY2 and isinstance ( arg , unicode ) ) : return arg . encode ( 'utf-8' ) return arg
only in python 2 .