def _interpolate_index(
    element, min_idx: int, max_idx: int, min_value, max_value
) -> int:
    """Calculates the estimated element index via interpolation"""

    if (value_range := max_value - min_value) == 0:
        return min_idx

    normalised_interpolated_value = (element - min_value) / value_range
    delta_idx = max_idx - min_idx
    return int(round(normalised_interpolated_value * delta_idx)) + min_idx