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.
Python nbconvert output shouldn't have output

Right now, we are adding a bunch of invalid content to Python nbconvert output.
there shouldn't be a 'files/' prefix in FileLink[s]

closes #3867
always point py3compat.input to builtin_mod.input

to preserve forwarding overrides made by the Kernel

closes #4583
Merge pull request #4922 from minrk/python-no-output

Python nbconvert output shouldn't have output
Merge pull request #4807 from richardeverson/ansilatex

Correct handling of ansi colour codes when nbconverting to latex
Merge pull request #4932 from minrk/input-lazy

always point py3compat.input to builtin_mod.input
fix line/statys typo in utils.submodule
Merge pull request #4849 from minrk/unicode-is-the-devil

Various unicode fixes (mostly on Windows)
Fix some doc formatting in pandoc checks.
use importlib.machinery when available

avoids deprecation warning on startup, and allows tests to pass with PYTHONWARNINGS=d

closes #4051

candidate for backport to 1.2
Fix some formatting in widget docstrings
Remove the docscrape modules, which are part of numpydoc
More minor doc fixes.