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 Find nearest neighbor in area with radius = distance.
  
  @param[in] point (list): Maximum distance where neighbors are searched.
  @param[in] distance (double): Maximum distance where neighbors are searched.
  @param[in] retdistance (bool): If True - returns neighbors with distances to them, otherwise only neighbors
              is returned.
  
  @return (node|list) Nearest neighbor if 'retdistance' is False and list with two elements [node, distance]
           if 'retdistance' is True, where the first element is pointer to node and the second element is
           distance to it.
docstr_tok: ["!","@","brief","Find","nearest","neighbor","in","area","with","radius","=","distance",".","@","param","[","in","]","point","(","list",")",":","Maximum","distance","where","neighbors","are","searched",".","@","param","[","in","]","distance","(","double",")",":","Maximum","distance","where","neighbors","are","searched",".","@","param","[","in","]","retdistance","(","bool",")",":","If","True","-","returns","neighbors","with","distances","to","them",",","otherwise","only","neighbors","is","returned",".","@","return","(","node|list",")","Nearest","neighbor","if","'retdistance","'","is","False","and","list","with","two","elements","[","node",",","distance","]","if","'retdistance","'","is","True",",","where","the","first","element","is","pointer","to","node","and","the","second","element","is","distance","to","it","."]
code: def find_nearest_dist_node(self, point, distance, retdistance=False):
      """!
      @brief Find nearest neighbor in area with radius = distance.
  
      @param[in] point (list): Maximum distance where neighbors are searched.
      @param[in] distance (double): Maximum distance where neighbors are searched.
      @param[in] retdistance (bool): If True - returns neighbors with distances to them, otherwise only neighbors
                  is returned.
  
      @return (node|list) Nearest neighbor if 'retdistance' is False and list with two elements [node, distance]
               if 'retdistance' is True, where the first element is pointer to node and the second element is
               distance to it.
  
      """
  
      best_nodes = self.find_nearest_dist_nodes(point, distance)
  
      if len(best_nodes) == 0:
          return None
  
      nearest = min(best_nodes, key=lambda item: item[0])
  
      if retdistance is True:
          return nearest
      else:
          return nearest[1]
  
imports: import numpy
  import matplotlib.pyplot
  from pyclustering.utils import euclidean_distance_square, find_left_element
label_desc: Use image node_id 9 for calling the kdtree_balanced obj's underlying member method code with example usage: obj.find_nearest_dist_node(point, distance, retdistance) and returns: None, nearest, nearest