def METHOD_NAME(self, key, value) -> None:
    if isinstance(value, TreeCacheNode):
        # this would mean we couldn't tell where our tree ended and the value
        # started.
        raise ValueError("Cannot store TreeCacheNodes in a TreeCache")
    node = self.root
    for k in key[:-1]:
        next_node = node.get(k, SENTINEL)
        if next_node is SENTINEL:
            next_node = node[k] = TreeCacheNode()
        elif not isinstance(next_node, TreeCacheNode):
            # this suggests that the caller is not being consistent with its key
            # length.
            raise ValueError("value conflicts with an existing subtree")
        node = next_node
    node[key[-1]] = value
    self.size += 1