def settling_time(set_point, input_series, bounding_radius, min_time):
    """
    Calculate the settling time of input_series to be bounded for min_time.

    Args:
        set_point: XYZWithTime of the reference point
        input_series (list): XYZWithTime of the points that should be evaluated
        bounding_radius: Float of the radius of the bounding sphere
        min_time: Float of the time, the input_series has to stay within bounds

    Returns:
        settling_time: Float of the time for input_series to be settled
    """
    bounded_time = False
    elems = len(input_series.x)
    for index in range(elems):
        current_time = input_series.time[index]
        x_error = (input_series.x[index] - set_point.x)
        y_error = (input_series.y[index] - set_point.y)
        z_error = (input_series.z[index] - set_point.z)
        error_radius = (x_error ** 2 + y_error ** 2 + z_error ** 2) ** 0.5
        if error_radius <= bounding_radius and not bounded_time:
            bounded_time = current_time
        elif (error_radius <= bounding_radius and bounded_time and
              current_time - bounded_time >= min_time):
            return bounded_time - input_series.time[0]
        elif (not bounded_time or error_radius <= bounding_radius and
              bounded_time):
            continue
        else:
            bounded_time = False
    return None