nodes: 0, module; 1, function_definition; 2, function_name:insert_ordered; 3, parameters; 4, block; 5, identifier:value; 6, identifier:array; 7, expression_statement; 8, expression_statement; 9, comment:# search for the last array item that value is larger than; 10, for_statement; 11, expression_statement; 12, return_statement; 13, comment:"""
      This will insert the value into the array, keeping it sorted, and returning the
      index where it was inserted
      """; 14, assignment; 15, identifier:n; 16, call; 17, block; 18, call; 19, identifier:index; 20, identifier:index; 21, integer:0; 22, identifier:range; 23, argument_list; 24, if_statement; 25, attribute; 26, argument_list; 27, integer:0; 28, call; 29, comparison_operator:value >= array[n]; 30, block; 31, identifier:array; 32, identifier:insert; 33, identifier:index; 34, identifier:value; 35, identifier:len; 36, argument_list; 37, identifier:value; 38, subscript; 39, expression_statement; 40, identifier:array; 41, identifier:array; 42, identifier:n; 43, assignment; 44, identifier:index; 45, binary_operator:n+1; 46, identifier:n; 47, integer:1
code: def insert_ordered(value, array):
      """
      This will insert the value into the array, keeping it sorted, and returning the
      index where it was inserted
      """
  
      index = 0
  
      # search for the last array item that value is larger than
      for n in range(0,len(array)):
          if value >= array[n]: index = n+1
  
      array.insert(index, value)
      return index