coalesce stream output in the notebook

This merges consecutive outputs on one stream into a single output.

Essentially, it applies the same merging that we do visually to the content stored in the notebook document.

This results in a massive performance improvement in load-time and storage size
for notebooks that have many calls to `sys.stdout.flush()`.
what’s new for coalescing stream output
test coalesced output in js
Merge pull request #6069 from minrk/coalesce_streams

coalesce stream output in the notebook