def insert(self, point, payload):
if self.__root is None:<EOL><INDENT>self.__dimension = len(point)<EOL>self.__root = node(point, payload, None, None, <NUM_LIT:0>)<EOL>self.__point_comparator = self.__create_point_comparator(type(point))<EOL>return self.__root<EOL><DEDENT>cur_node = self.__root<EOL>while True:<EOL><INDENT>if cur_node.data[cur_node.disc] <= point[cur_node.disc]:<EOL><INDENT>if cur_node.right is None:<EOL><INDENT>discriminator = cur_node.disc + <NUM_LIT:1><EOL>if discriminator >= self.__dimension:<EOL><INDENT>discriminator = <NUM_LIT:0><EOL><DEDENT>cur_node.right = node(point, payload, None, None, discriminator, cur_node)<EOL>return cur_node.right<EOL><DEDENT>else: <EOL><INDENT>cur_node = cur_node.right<EOL><DEDENT><DEDENT>else:<EOL><INDENT>if cur_node.left is None:<EOL><INDENT>discriminator = cur_node.disc + <NUM_LIT:1><EOL>if discriminator >= self.__dimension:<EOL><INDENT>discriminator = <NUM_LIT:0><EOL><DEDENT>cur_node.left = node(point, payload, None, None, discriminator, cur_node)<EOL>return cur_node.left<EOL><DEDENT>else:<EOL><INDENT>cur_node = cur_node.left<EOL><DEDENT><DEDENT><DEDENT>
!
        @brief Insert new point with payload to kd-tree.

        @param[in] point (list): Coordinates of the point of inserted node.
        @param[in] payload (any-type): Payload of inserted node. It can be identificator of the node or
                    some useful payload that belongs to the point.

        @return (node) Inserted node to the kd-tree.