code: def get_encoded_writer (out=sys.stdout, encoding=None, errors='replace'):
      
      if encoding is None:
          encoding = default_encoding
      Writer = codecs.getwriter(encoding)
      return Writer(out, errors)
docs: Get wrapped output writer with given encoding and error handling.