'Turns a message in JSON format into an appropriate Message
instance.  This is called when cells receive a message from
another cell.'

def message_from_json(self, json_message):

    message_dict = jsonutils.loads(json_message)
    ctxt = message_dict['ctxt']
    message_dict['ctxt'] = context.RequestContext.from_dict(ctxt)
    method_kwargs = message_dict['method_kwargs']
    for (k, v) in method_kwargs.items():
        method_kwargs[k] = self.serializer.deserialize_entity(message_dict['ctxt'], v)
    message_type = message_dict.pop('message_type')
    message_cls = _CELL_MESSAGE_TYPE_TO_MESSAGE_CLS[message_type]
    return message_cls(self, **message_dict)
