class_docstr: !
  @brief Represents balanced static KD-tree that does not provide services to add and remove nodes after
          initialization.
  @details In the term KD tree, k denotes the dimensionality of the space being represented. Each data point is
            represented as a node in the k-d tree in the form of a record of type node.
  
  There is an example how to create KD-tree:
  @code
      from pyclustering.container.kdtree import kdtree_balanced, kdtree_visualizer
      from pyclustering.utils import read_sample
      from pyclustering.samples.definitions import FCPS_SAMPLES
  
      sample = read_sample(FCPS_SAMPLES.SAMPLE_LSUN)
      tree_instance = kdtree_balanced(sample)
  
      kdtree_visualizer(tree_instance).visualize()
  @endcode
  
  Output result of the example above - figure 1.
  @image html kd_tree_balanced_lsun.png "Fig. 1. Balanced KD-tree for sample 'Lsun'."
  
  @see kdtree
class_docstr_tok: ["!","@","brief","Represents","balanced","static","KD-tree","that","does","not","provide","services","to","add","and","remove","nodes","after","initialization",".","@","details","In","the","term","KD","tree",",","k","denotes","the","dimensionality","of","the","space","being","represented",".","Each","data","point","is","represented","as","a","node","in","the","k-d","tree","in","the","form","of","a","record","of","type","node",".","There","is","an","example","how","to","create","KD-tree",":","@","code","from","pyclustering.container.kdtree","import","kdtree_balanced",",","kdtree_visualizer","from","pyclustering.utils","import","read_sample","from","pyclustering.samples.definitions","import","FCPS_SAMPLES","sample","=","read_sample","(","FCPS_SAMPLES.SAMPLE_LSUN",")","tree_instance","=","kdtree_balanced","(","sample",")","kdtree_visualizer","(","tree_instance",")",".visualize","(",")","@","endcode","Output","result","of","the","example","above","-","figure","1",".","@","image","html","kd_tree_balanced_lsun.png","``","Fig",".","1",".","Balanced","KD-tree","for","sample","'Lsun","'",".","''","@","see","kdtree"]
docstr: !
  @brief Search node that satisfy to parameters in search rule.
  @details If node with specified parameters does not exist then None will be returned,
            otherwise required node will be returned.
  
  @param[in] point (list): Coordinates of the point whose node should be found.
  @param[in] search_rule (lambda): Rule that is called to check whether node satisfies to search parameter.
  @param[in] cur_node (node): Node from which search should be started.
  
  @return (node) Node if it satisfies to input parameters, otherwise it return None.
docstr_tok: ["!","@","brief","Search","node","that","satisfy","to","parameters","in","search","rule",".","@","details","If","node","with","specified","parameters","does","not","exist","then","None","will","be","returned",",","otherwise","required","node","will","be","returned",".","@","param","[","in","]","point","(","list",")",":","Coordinates","of","the","point","whose","node","should","be","found",".","@","param","[","in","]","search_rule","(","lambda",")",":","Rule","that","is","called","to","check","whether","node","satisfies","to","search","parameter",".","@","param","[","in","]","cur_node","(","node",")",":","Node","from","which","search","should","be","started",".","@","return","(","node",")","Node","if","it","satisfies","to","input","parameters",",","otherwise","it","return","None","."]
code: def _find_node_by_rule(self, point, search_rule, cur_node):
      """!
      @brief Search node that satisfy to parameters in search rule.
      @details If node with specified parameters does not exist then None will be returned,
                otherwise required node will be returned.
  
      @param[in] point (list): Coordinates of the point whose node should be found.
      @param[in] search_rule (lambda): Rule that is called to check whether node satisfies to search parameter.
      @param[in] cur_node (node): Node from which search should be started.
  
      @return (node) Node if it satisfies to input parameters, otherwise it return None.
  
      """
  
      if cur_node is None:
          cur_node = self._root
  
      while cur_node:
          if cur_node.data[cur_node.disc] <= point[cur_node.disc]:
              # no need to check each node, only when it may satisfy the condition
              if search_rule(
                  cur_node
              ):  # compare point with point in the current node
                  return cur_node
  
              cur_node = cur_node.right
          else:
              cur_node = cur_node.left
  
      return None
  
imports: import numpy
  import matplotlib.pyplot
  from pyclustering.utils import euclidean_distance_square, find_left_element
label_desc: Use image node_id 6 for calling the kdtree_balanced obj's underlying member method code with example usage: obj._find_node_by_rule(point, search_rule, cur_node) and returns: None, cur_node