def _set_item_impl(self, key: Any, value: Any) -> None:
    "\n        Changes the value of the node key with the desired value. If the node key doesn't\n        exist it creates a new one.\n        "
    from .nodes import AnyNode, ValueNode
    if isinstance(value, Node):
        do_deepcopy = (not self._get_flag('no_deepcopy_set_nodes'))
        if ((not do_deepcopy) and isinstance(value, Container)):
            if (self._get_root() is value._get_root()):
                do_deepcopy = True
        if do_deepcopy:
            value = copy.deepcopy(value)
        value._set_parent(None)
        try:
            old = value._key()
            value._set_key(key)
            self._validate_set(key, value)
        finally:
            value._set_key(old)
    else:
        self._validate_set(key, value)
    if self._get_flag('readonly'):
        raise ReadonlyConfigError('Cannot change read-only config container')
    input_is_node = isinstance(value, Node)
    target_node_ref = self._get_node(key)
    input_is_typed_vnode = (isinstance(value, ValueNode) and (not isinstance(value, AnyNode)))
    target_is_vnode = isinstance(target_node_ref, ValueNode)

    def get_target_type_hint(val: Any) -> Any:
        if (not is_structured_config(val)):
            type_hint = self._metadata.element_type
        else:
            target = self._get_node(key)
            if (target is None):
                type_hint = self._metadata.element_type
            else:
                assert isinstance(target, Node)
                type_hint = target._metadata.type_hint
        return type_hint

    def assign(value_key: Any, val: Node) -> None:
        assert (val._get_parent() is None)
        v = val
        v._set_parent(self)
        v._set_key(value_key)
        _deep_update_type_hint(node=v, type_hint=self._metadata.element_type)
        self.__dict__['_content'][value_key] = v
    if input_is_typed_vnode:
        assign(key, value)
    else:
        special_value = _is_special(value)
        type_hint = get_target_type_hint(value)
        should_set_value = ((target_node_ref is not None) and (special_value or (isinstance(target_node_ref, Container) and target_node_ref._has_ref_type()) or (target_is_vnode and (not isinstance(target_node_ref, AnyNode))) or (isinstance(target_node_ref, AnyNode) and is_primitive_type(value))))
        if should_set_value:
            if (special_value and isinstance(value, Node)):
                value = value._value()
            self.__dict__['_content'][key]._set_value(value)
        elif input_is_node:
            (_, ref_type) = _resolve_optional(type_hint)
            if (special_value and (is_container_annotation(ref_type) or is_structured_config(ref_type))):
                self._wrap_value_and_set(key, value._value(), type_hint)
            else:
                assign(key, value)
        else:
            self._wrap_value_and_set(key, value, type_hint)
Changes the value of the node key with the desired value. If the node key doesn't
exist it creates a new one.
def _set_item_impl(self, key: Any, value: Any) -> None:
    "\n        Changes the value of the node key with the desired value. If the node key doesn't\n        exist it creates a new one.\n        "
    from .nodes import AnyNode, ValueNode
    if isinstance(value, Node):
        do_deepcopy = (not self._get_flag('no_deepcopy_set_nodes'))
        if ((not do_deepcopy) and isinstance(value, Container)):
            if (self._get_root() is value._get_root()):
                do_deepcopy = True
        if do_deepcopy:
            value = copy.deepcopy(value)
        value._set_parent(None)
        try:
            old = value._key()
            value._set_key(key)
            self._validate_set(key, value)
        finally:
            value._set_key(old)
    else:
        self._validate_set(key, value)
    if self._get_flag('readonly'):
        raise ReadonlyConfigError('Cannot change read-only config container')
    input_is_node = isinstance(value, Node)
    target_node_ref = self._get_node(key)
    input_is_typed_vnode = (isinstance(value, ValueNode) and (not isinstance(value, AnyNode)))
    target_is_vnode = isinstance(target_node_ref, ValueNode)

    def get_target_type_hint(val: Any) -> Any:
        if (not is_structured_config(val)):
            type_hint = self._metadata.element_type
        else:
            target = self._get_node(key)
            if (target is None):
                type_hint = self._metadata.element_type
            else:
                assert isinstance(target, Node)
                type_hint = target._metadata.type_hint
        return type_hint

    def assign(value_key: Any, val: Node) -> None:
        assert (val._get_parent() is None)
        v = val
        v._set_parent(self)
        v._set_key(value_key)
        _deep_update_type_hint(node=v, type_hint=self._metadata.element_type)
        self.__dict__['_content'][value_key] = v
    if input_is_typed_vnode:
        assign(key, value)
    else:
        special_value = _is_special(value)
        type_hint = get_target_type_hint(value)
        should_set_value = ((target_node_ref is not None) and (special_value or (isinstance(target_node_ref, Container) and target_node_ref._has_ref_type()) or (target_is_vnode and (not isinstance(target_node_ref, AnyNode))) or (isinstance(target_node_ref, AnyNode) and is_primitive_type(value))))
        if should_set_value:
            if (special_value and isinstance(value, Node)):
                value = value._value()
            self.__dict__['_content'][key]._set_value(value)
        elif input_is_node:
            (_, ref_type) = _resolve_optional(type_hint)
            if (special_value and (is_container_annotation(ref_type) or is_structured_config(ref_type))):
                self._wrap_value_and_set(key, value._value(), type_hint)
            else:
                assign(key, value)
        else:
            self._wrap_value_and_set(key, value, type_hint)