def EncodeAndWriteToStdout(s, encoding='utf-8'):
 if PY3:
  sys.stdout.buffer.write(codecs.encode(s, encoding))
 else:
  sys.stdout.write(s.encode(encoding))

def EncodeAndWriteToStdout ( s , encoding = 'utf-8' ) : if PY3 : sys . stdout . buffer . write ( codecs . encode ( s , encoding ) ) else : sys . stdout . write ( s . encode ( encoding ) )
encode the given string and emit to stdout .