<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_encoded_writer (out=sys.stdout, encoding=None, errors='replace'):
 """Get wrapped output writer with given encoding and error handling."""

    if encoding is None:
        encoding = default_encoding
    Writer = codecs.getwriter(encoding)
    return Writer(out, errors)