Update widget serializer/unserializer to allow custom serialization on a trait-by-trait basis.

Serializers/unserializers are given as the trait metadata keys `to_json` and `from_json`.
Give subclasses of the Instance traitlet the option of overriding the klass variable to have a default klass.

This makes it easy to construct traitlets for specific object types and default metadata.  For example, we can have a traitlet for numpy arrays that gives default values for `to_json` and `from_json`:

```python
def np_to_list(a):
    if a is not None:
        return a.tolist()
def np_from_list(a):
    if a is not None:
        return np.array(a)

class NDArray(Instance):
    klass = np.ndarray
    metadata = {'to_json': np_to_list,
                'from_json': np_from_list}
```

Then the NDArray traitlet will by default have the klass and some custom metadata.
Prepend a sentinel value to model ids to distinguish them from normal UUIDs (from Sylvain Corlay).
Change serialization terminology to serialize/deserialize
once-displayed
unnecessary context variable specify
incorrect comment
Simplify the code for picking json serialization functions to expose the logic better
Add a requirejs shim for highlight.js

Before this, highlighting code in markdown cells was broken since hljs wasn't available.

A better solution might be to build the highlight.js amd module (i.e., build the highlight.js module with `--target=amd`) so that we don't need the shim.
restore websocket_url configurable

allows ws to be handled via separate proxies,
as appears to be the case on OpenShift and some other hosting services.
pass ws_url to kernel constructor

via session constructor via notebook constructor…
return global events from require(['base/js/events']).

In master, it is impossible to load code on IPython events without setting timeouts.
don’t use events !== undefined to signal page ready

it will always be defined
Trigger app_initialized event *after* the 'global' IPython object is initialized
preserve backward-compatible $([IPython.events])
don’t load custom.js in page template

we are loading it in require, and don’t want to load it twice
fix docstring in events.js

example shows registering a handler, not triggering an event.
note loaded, unused dependencies in require
use global events in js tests
use ask_exit payload in terminal console

avoid special frontend handling for ‘exit’

We really need to totally reconstruct how kernel shutdown works in the console interfaces, but at least this makes it behave as intended currently.