trigger `Kernel.status_started` after websockets open

This leads to a more logical state for event watchers to expect.
don't 'restore_bytes' in from_JSON

it makes no sense to turn base64-encoded unicode strings into base64-encoded byte strings.  I can't think why we do this, but we should be very careful about testing before merging this fix.

fixes the issue tested in #4036.
update test_extract_output
use cast_unicode in nbformat
test that PNG / JPEG output data are unicode
Test no incorrect 'data:image/png;base64,b' in html files.
stonebig's test shouldn't fail anymore
note that restore_bytes is never used
Fix citation2latex for Python 3
Fix pylabtools test for Python 3
move kernel-test utilities to kernel.tests.utils

context managers and tools for starting kernels,
and sharing a *single* global kernel for many tests.

reduce the number of kernels started for IPython.kernel tests,
which should save some time.
add missing `now` to MKM.restart
use forceful restart / shutdown in KM / MKM tests
remove kernel.tests.__init__
cleanup in kernel.tests.utils
Fix for incorrect default encoding on Windows.
Merge pull request #4163 from dhirschfeld/encoding-fix

Fix for incorrect default encoding on Windows.
add missing data_javascript

Note that javascript is still excluded from html output by default.

candidate for backport to 1.1
test binary data passed to output

data is coerced to unicode (cast with 'replace', so no errors)
minor adjustments to markdown / rst templates

- remote prompts from output
- add missing HTML block
- remove double-wrapping of latex
- use plain-markdown indentation for code blocks (could use GFM '` ` `python')

closes #4024

candidate for backport to 1.1