def get_lat_array(bw, bw_array, lat_array):
    """
    Returns the latency for measured bandwidth using bandwidth-latency dependency.
    @params:
     bw        - Required : measured bandwidth (Float)
     bw_array  - Required : array of measured bandwidths for bw-lat dependency (List of floats)
     lat_array - Required : array of measured latencies for bw-lat dependency (List of floats)

    """
    if bw > bw_array[len(bw_array)-1]:
        return lat_array[len(bw_array)-1]
    i = 0
    while bw > bw_array[i]:
        i+=1
        if i == len(bw_array):
            return 0

    if i == 0:
        return lat_array[0]
    else:
        bw_percent = ( bw - bw_array[i-1] )/( bw_array[i] - bw_array[i-1] )
        latency = lat_array[i-1] + bw_percent*(lat_array[i] - lat_array[i-1])
        return latency