def write_to_output(content, output=None,<EOL>encoding=anytemplate.compat.ENCODING):
if anytemplate.compat.IS_PYTHON_3 and isinstance(content, bytes):<EOL><INDENT>content = str(content, encoding)<EOL><DEDENT>if output and not output == '<STR_LIT:->':<EOL><INDENT>_write_to_filepath(content, output)<EOL><DEDENT>elif anytemplate.compat.IS_PYTHON_3:<EOL><INDENT>print(content)<EOL><DEDENT>else:<EOL><INDENT>print(content.encode(encoding.lower()), file=get_output_stream())<EOL><DEDENT>
:param content: Content string to write to
:param output: Output destination
:param encoding: Character set encoding of outputs