def insert(self, iterable, index=0, data=None, weight=1.0):
        """Insert new node into tree

        Args:
            iterable(hashable): key used to find in the future.
            data(object): data associated with the key
            index(int): an index used for insertion.
            weight(float): the wait given for the item added.
        """
        if index == len(iterable):
            self.is_terminal = True
            self.key = iterable
            self.weight = weight
            if data:
                self.data.add(data)
        else:
            if iterable[index] not in self.children:
                self.children[iterable[index]] = TrieNode()
            self.children[iterable[index]].insert(iterable, index + 1, data)
def insert ( self , iterable , index = 0 , data = None , weight = 1.0 ) : if index == len ( iterable ) : self . is_terminal = True self . key = iterable self . weight = weight if data : self . data . add ( data ) else : if iterable [ index ] not in self . children : self . children [ iterable [ index ] ] = TrieNode ( ) self . children [ iterable [ index ] ] . insert ( iterable , index + 1 , data )
Insert new node into tree

        Args:
            iterable(hashable): key used to find in the future.
            data(object): data associated with the key
            index(int): an index used for insertion.
            weight(float): the wait given for the item added.