Deserialize special kinds of dicts from _serializeNT().

def _deserializeNT(data, glob):
    """
    Deserialize special kinds of dicts from _serializeNT().
    """
    if isinstance(data, list):
        return [_deserializeNT(item, glob) for item in data]

    elif isinstance(data, tuple):
        return tuple(_deserializeNT(item, glob) for item in data)

    elif isinstance(data, dict) and "__nt_name" in data:  # is namedtuple
        class_name = data["__nt_name"]
        del data["__nt_name"]

        # given globals
        if class_name in glob:
            return glob[class_name](
                **dict(zip(data, _deserializeNT(data.values(), glob)))
            )

        # "local" (package) globals
        return globals()[class_name](
            **dict(zip(data, _deserializeNT(data.values(), glob)))
        )

    elif isinstance(data, dict):
        return {
            key: _deserializeNT(data[key], glob)
            for key in data
        }

    elif isinstance(data, unicode):
        return data.encode("utf-8")

    return data