Transforms back a serialized value of `serialize()`

def unserialize(wd: WordDictionary, text: Dict):
    """
    Transforms back a serialized value of `serialize()`
    """

    if not isinstance(text, Mapping):
        raise ValueError('Text has not the right format')

    try:
        t = text['type']

        if t == 'string':
            return text['value']
        elif t == 'trans':
            if not isinstance(text['params'], Mapping):
                raise ValueError('Params should be a dictionary')

            for param in text['params']:
                if not isinstance(param, str):
                    raise ValueError('Params are not all text-keys')

            return StringToTranslate(
                wd=wd,
                key=text['key'],
                count=text['count'],
                params=text['params'],
            )
        else:
            raise ValueError('Unknown type "{}"'.format(t))
    except KeyError:
        raise ValueError('Not enough information to unserialize')