Search for first existing directory, if cwd doesn't exist.

When starting an ipython application in a directory, that doens't exist,
search for first existing directory upwards instead of crashing.

See bug:
https://bugzilla.redhat.com/show_bug.cgi?id=593115
Report if cwd does not exist and raise exception in BaseIPythonApplication

Catch the exception in the starting scripts, report the exception
and exit gracefully. Do not directly exit in BaseIPythonApplication so
that external applications can also catch the exception instead of exiting.
Use @catch_config_error to catch exception from getcwdu in nonexisting directory
Added clickable icon to collapse pager

Closes #3196
changed ESC to trigger collapsing of the pager in notebook
Collapse -> Close in button description as suggested by @fperez
add git hooks for submodules

A much less intrusive version of #3274 that has effect on checkout / pull / merge,
rather than setup.py.  It does require a user install step,
because you cannot add active hooks to a repo.
add utils.submodule
use utils/submodule in setup.py

`setup.py anything` will halt with an informative error
if the submodules are unclean.

It will fetch the submodules if they are entirely absent.

Nothing will happen if it is not a git repo.
check submodules when starting the notebook server

shows a warning (not an error) if components are out of date.
mention git hooks in top-level readme
add LevelFormatter for extra formatting on high level messages

the asctime datefmt is also configurable now
use highlevel in notebook log format

datefmt no longer necessary
use LevelFormatter in parallel apps
tweak default highlevel_format
demote connection info to log.info

also rprint if no parent (`ipython kernel`)
fix ignored IOPub messages with no parent

there was a `continue` without a new `recv`,
which would cause an infinite loop.
cast sequences without len to lists in map

allows some generators, etc.
allow map objects to partition specified lengths
allow view.map to accept unequal sequence sizes

`builtin.map` pads with None rather than failing on mismatches sizes.