<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def get_output_stream(encoding=anytemplate.compat.ENCODING, ostream=sys.stdout):
 """ 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 """

    return codecs.getwriter(encoding)(ostream)