code: def set(self, path, item, replace):
          
          if len(path) == 0:
              if self._item is None or replace:
                  self._item = item
  
              return self._item
  
          else:
              head, tail = path[0], path[1:]
  
              if head.startswith(':'):
                  default = (head[1:], self.__class__())
                  _, rtree = self._subtrees.setdefault(self._WILDCARD, default)
                  return rtree.set(tail, item, replace)
  
              else:
                  rtree = self._subtrees.setdefault(head, self.__class__())
                  return rtree.set(tail, item, replace)
docs: Sets item for `path` and returns the item.
          Replaces existing item with `item` when `replace` is true
  
          :param path: Path for item
          :param item: New item
          :param replace: Updating mode
          :type path: list
          :type item: object
          :type replace: bool