<s> import sys <EOL> import six <EOL> def force_encode ( func ) : <EOL> """<STR_LIT>""" <EOL> if six . PY2 : <EOL> def _func ( * args , ** kwargs ) : <EOL> result = func ( * args , ** kwargs ) . encode ( sys . stdout . encoding or '<STR_LIT:utf-8>' ) <EOL> if isinstance ( result , unicode ) : <EOL> return result . encode ( '<STR_LIT:utf-8>' ) <EOL> return result <EOL> return _func <EOL> return func </s>
