code: def find_nearest_index(arr, value):
      
      arr = np.array(arr)
      index = (abs(arr-value)).argmin()
      return index
docs: For a given value, the function finds the nearest value
      in the array and returns its index.