Constructor for a StreamWriter instance.
All stream writers must provide this constructor interface. They are free to add
additional keyword arguments, but only the ones defined here are used by the Python codec
registry.
stream must be a file-like object open for writing (binary) data.
The StreamWriter may implement different error handling schemes
by providing the errors keyword argument. These parameters are predefined:
'strict' Raise ValueError (or a subclass);
this is the default.
'ignore' Ignore the character and continue with the next.
'replace' Replace with a suitable replacement character
'xmlcharrefreplace' Replace with the appropriate XML character
reference
'backslashreplace' Replace with backslashed escape sequences.
The errors argument will be assigned to an attribute of the same name.
Assigning to this attribute makes it possible to switch between different error handling
strategies during the lifetime of the StreamWriter object.
The set of allowed values for the errors argument can be extended with register_error().