Support writing output to stdout by using out=stdout.
Merge pull request #620 from mfellner/master

Support writing output to stdout by using out=stdout.