def __setitem__(self, key, value):
        if key in self:
            self._unset_container(self[key])
        try:
            self._set_container(value)
        except ContainerError:
            if key in self:
                self._set_container(self[key])
            raise
        dict.__setitem__(self,key,value)