send shutdown_request on exit of `ipython console`

closes #4516
only shutdown kernel when it is owned by the console
bash completion: add nbconvert and history subcmds
bash completion: generalize subcmd completer logic
bash completion: profile, history, locate cmds
bash completion: ipython <tab> shows only subcmds

If a partial filename, or an flag or option argument is invoked, those
completions will still take place, but by default, to aid the user in
the discovery of subcommands, pressing tab immediately after ipython
will list *only* the subcommands as possible completions
bash completion: subcmds get a trailing space

thanks to @juliantaylor for providing the patch
Hide dynamically defined metaclass base from Sphinx.

The inheritance diagram extension in Sphinx 1.2 stores class references,
which Sphinx then tries to pickle. This chokes on our dynamically
defined base classes from the with_metaclass function. Starting the name
with an underscore makes Sphinx ignore the class.

(Bug obscurity/fix simplicity) ratio is high.
Don't warn on empty modules when scanning API
Update API doc skip patterns
Clean up numpydoc section headers
Merge pull request #4532 from takluyver/sphinx-1.2-dynamic-metaclasses

Hide dynamically defined metaclass base from Sphinx.
Various minor docs fixes
Use new format for intersphinx mapping
Various docs fixes
Merge pull request #4528 from ivanov/completion-update

improvements to bash completion
Miscellaneous docs fixes
More fixes to doc formatting
Correct %edit docstring for ZMQ shell
Produce rst-compatible options lists from magic_arguments