def get_output_stream(encoding=anytemplate.compat.ENCODING,<EOL>ostream=sys.stdout):
return codecs.getwriter(encoding)(ostream)<EOL>
Get output stream take care of characters encoding correctly.

:param ostream: Output stream (file-like object); sys.stdout by default
:param encoding: Characters set encoding, e.g. UTF-8
:return: sys.stdout can output encoded strings

>>> get_output_stream("UTF-8")  # doctest: +ELLIPSIS
<encodings.utf_8.StreamWriter ... at 0x...>