code: def get_ordered_values(self, keypath, distance_from, open_interval=True):
          values = []
          if keypath[0] == 'target':
              keypath = keypath[1:]
          for _, instance in self.iter_singleton_referents():
              value = instance.get_value_from_path(keypath)
              if hasattr(value, 'low') and value.low != value.high:
                  return []
              values.append(float(value))
          if len(values) == 0:
              return []
          values = np.array(values)
          anchor = values.min()
          diffs = values - anchor
          if distance_from == 'max':
              anchor = values.max()
              diffs = anchor - values
          if distance_from == 'mean':
              anchor = values.mean()
              diffs = abs(anchor - values)
          sdiffs = np.unique(diffs)
          sdiffs.sort()
          results = []
          for ix, el in enumerate(sdiffs):
              mask = diffs <= el
              vals = values[mask]
              if False:
                  results.append(IntervalCell(vals.min(), vals.max()))
              elif distance_from == 'max':
                  if open_interval:
                      results.append(IntervalCell(vals.min(), np.inf))
                  else:
                      results.append(IntervalCell(vals.min(), vals.min()))
              elif distance_from == 'min':
                  if open_interval:
                      results.append(IntervalCell(-np.inf, vals.max()))
                  else:
                      results.append(IntervalCell(vals.max(), vals.max()))
              elif distance_from == 'mean':
                  if ix+1 == len(sdiffs): continue
                  results.append(IntervalCell(vals.min(), vals.max()))
          return results