def get_interval(value, intervals):
    """
    Returns the index of the interval the value lies in.

    :param value: Value for which to find the interval.
    :param intervals: List or tuple of interval with values which represent the upper boundary of each interval.
    The first interval starts at 0 and ends ar the first value (excluded, except for the last interval).
    :return: Index in regard to the intervals list/tupple.
    """
    if value is None or isinstance(value, str):
        return
    for i in range(len(intervals)):
        if abs(value) < intervals[i]:
            return i
    return len(intervals) - 1