Deal with ansi escape codes when nbconverting to latex

Correctly deals with "reset" codes and short codes.  Interprets blinking
style as bold.
avoid import of nearby temporary with %edit

use mk**s**temp now,
and create files in subfolders.

should close gh-4731

Note that some part of the logic could now use
http://docs.python.org/2/library/tempfile.html#tempfile.NamedTemporaryFile
That will be deleted on close and avoid IPython to track it.
don't add unicode paths to sys.path

on Python 2

causes unicode warnings comparing unicode to str when non-ascii
add prefer_stream arg to utils.encoding.getdefaultencoding

sometimes the stream encoding should be ignored,
and start with locale (e.g. Popen on Windows Python 2).

Default behavior is unchanged.
Popen doesn't support unicode args on Windows Python 2
unicode sadness on Windows in the submodule check
Use int style instead of string.
New test case from MinRK.
add notebook signing to nbformat
sign notebooks
add nbformat.sign.NotebookNotary
add `ipython notebook trust` subcommand
use configured scheme, not stored scheme when checking signatures

protects against notebook author choosing bad hash scheme.
Notaries sign notebooks now
move `ipython notebook trust` to `ipython trust`

and move App definition to nbformat.sign (maybe it should get its own file).
tweak default profile_dir

needed for testing
test notebook signing
get_output_cell fails with no such output

rather than returning null
Removing Kernel menu.
Add kernel restart button to toolbar.
Cleaning up output management in code and menus.