Add support for encoding on write; #1

This adds an `encoding' knob on the pattern of `should_dedent`, to
encode str/unicode to bytes/str on write.