create StdoutBuffer as a variant

This enables us to keep sending byte strings
to stdout.write(), like done in Python 2.