Decorator for deserializers.

    A deserializer should accept three parameters: A type, a dictionary, and a
    path that may contain supplementary data stored by its paired serializer.
    If the serializer stores supplementary data, the relative path to it should
    be somewhere in the dict of the second parameter.

def deserializer(_type):
    """
    Decorator for deserializers.

    A deserializer should accept three parameters: A type, a dictionary, and a
    path that may contain supplementary data stored by its paired serializer.
    If the serializer stores supplementary data, the relative path to it should
    be somewhere in the dict of the second parameter.
    """

    def inner(func):
        name = dr.get_name(_type)
        if name in DESERIALIZERS:
            msg = "%s already has a deserializer registered: %s"
            raise Exception(msg % (dr.get_name(name), dr.get_name(DESERIALIZERS[name])))
        DESERIALIZERS[name] = (_type, func)
        return func
    return inner