code: def get_bins(
      bins: Series, bin_index: list, bin_epsilon: float
  ) -> IntervalIndex:
      max_val = bins.max()
      bins_2 = bins.iloc[bin_index]
      bins_3 = list(bins_2.values)
      bins_unique = sorted(list(set(bins_3)))
      bins_with_epsilon_max = set(
          [i for i in bins_unique]
          + [i - bin_epsilon for i in bins_unique if i == max_val]
      )
      removal_bins = set(
          [
              bins_unique[index - 1]
              for index, i in enumerate(bins_unique[1:], start=1)
              if i == max_val
          ]
      )
      bins_4 = sorted(list(bins_with_epsilon_max - removal_bins))
      bins_5 = [np.inf if (x == max_val) else x for x in bins_4]
      bins_6 = sorted(list(set([-np.inf] + bins_5 + [np.inf])))
      bins_7 = [
          (bins_6[i], bins_6[i + 1]) for i in range(len(bins_6) - 1)
      ]
      interval_index = IntervalIndex.from_tuples(bins_7)
      return interval_index
  
imports: import logging
  import numpy
  import pandas
  from pandas import DataFrame, IntervalIndex, Series
label_desc: Use image node_id 3 for calling a global function with example usage: get_bins(bins, bin_index, bin_epsilon) and returns: interval_index