'Custom JSON decoder for Events.
Can be used as the ``object_hook`` argument of ``json.load`` or
``json.loads``.
Args:
dct (dict) : a JSON dictionary to decode
The dictionary should have keys ``event_name`` and ``event_values``
Raises:
ValueError, if the event_name is unknown
Examples:
.. code-block:: python
>>> import json
>>> from bokeh.events import Event
>>> data = \'{"event_name": "pan", "event_values" : {"model_id": 1, "x": 10, "y": 20, "sx": 200, "sy": 37}}\'
>>> json.loads(data, object_hook=Event.decode_json)
<bokeh.events.Pan object at 0x1040f84a8>'

@classmethod
def decode_json(cls, dct):

    if (not (('event_name' in dct) and ('event_values' in dct))):
        return dct
    event_name = dct['event_name']
    if (event_name not in _CONCRETE_EVENT_CLASSES):
        raise ValueError(('Could    not    find    appropriate    Event    class    for    event_name:    %r' % event_name))
    event_values = dct['event_values']
    model_id = event_values.pop('model_id')
    event = _CONCRETE_EVENT_CLASSES[event_name](model=None, **event_values)
    event._model_id = model_id
    return event
