def METHOD_NAME(self, val):
    """
    This is the public restoration method.  It will be applied to dictionary
    values, list items, and the value itself, checking for a `typename` key and
    applying the from_dict function of any registered type, or return the value
    unchanged if it is not recognized.
    :param val: the value to be converted
    Returns:
        the restored object for registered objects or the original for
        unregistered values
    """
    if isinstance(val, dict) and 'typename' in val:
        from_dict = self.convert_from_dict.get(val.pop('typename'))
        return from_dict(val)
    elif isinstance(val, dict):
        return dict((k, self.METHOD_NAME(v)) for k, v in val.items())
    if isinstance(val, (list, tuple, set)):
        return val.__class__([ self.METHOD_NAME(item) for item in val ])
    else:
        return val