nodes: 0, module; 1, function_definition; 2, function_name:find_nearest; 3, parameters; 4, block; 5, identifier:sorted_list; 6, identifier:x; 7, expression_statement; 8, if_statement; 9, comment:"""
      Find the nearest item of x from sorted array.
  
      :type array: list
      :param array: an iterable object that support inex
  
      :param x: a comparable value
  
      note: for finding the nearest item from a descending array, I recommend
      find_nearest(sorted_list[::-1], x). Because the built-in list[::-1] method
      is super fast.
  
      Usage::
  
          >>> find_nearest([0, 1, 2, 3, 4, 5, 6, 7, 8, 9], 5.1)
          5
  
      **中文文档**
  
      在正序数组中, 返回最接近x的数。
      """; 10, comparison_operator:x <= sorted_list[0]; 11, block; 12, elif_clause; 13, else_clause; 14, identifier:x; 15, subscript; 16, return_statement; 17, comparison_operator:x >= sorted_list[-1]; 18, block; 19, block; 20, identifier:sorted_list; 21, integer:0; 22, subscript; 23, identifier:x; 24, subscript; 25, return_statement; 26, expression_statement; 27, expression_statement; 28, if_statement; 29, identifier:sorted_list; 30, integer:0; 31, identifier:sorted_list; 32, unary_operator; 33, subscript; 34, assignment; 35, assignment; 36, comparison_operator:(x - lower) > (upper - x); 37, block; 38, else_clause; 39, integer:1; 40, identifier:sorted_list; 41, unary_operator; 42, identifier:lower; 43, call; 44, identifier:upper; 45, call; 46, parenthesized_expression; 47, parenthesized_expression; 48, return_statement; 49, block; 50, integer:1; 51, identifier:find_le; 52, argument_list; 53, identifier:find_ge; 54, argument_list; 55, binary_operator:x - lower; 56, binary_operator:upper - x; 57, identifier:upper; 58, return_statement; 59, identifier:sorted_list; 60, identifier:x; 61, identifier:sorted_list; 62, identifier:x; 63, identifier:x; 64, identifier:lower; 65, identifier:upper; 66, identifier:x; 67, identifier:lower
code: def find_nearest(sorted_list, x):
      """
      Find the nearest item of x from sorted array.
  
      :type array: list
      :param array: an iterable object that support inex
  
      :param x: a comparable value
  
      note: for finding the nearest item from a descending array, I recommend
      find_nearest(sorted_list[::-1], x). Because the built-in list[::-1] method
      is super fast.
  
      Usage::
  
          >>> find_nearest([0, 1, 2, 3, 4, 5, 6, 7, 8, 9], 5.1)
          5
  
      **中文文档**
  
      在正序数组中, 返回最接近x的数。
      """
      if x <= sorted_list[0]:
          return sorted_list[0]
      elif x >= sorted_list[-1]:
          return sorted_list[-1]
      else:
          lower = find_le(sorted_list, x)
          upper = find_ge(sorted_list, x)
          if (x - lower) > (upper - x):
              return upper
          else:
              return lower