def _find_last_larger_than(target, val_array):
    """
    Takes an array and finds the last value larger than the target value.
    Returns the index of that value, returns -1 if none exists in array.
    """
    ind = -1
    for j in range(len(val_array), 0, -1):
        if val_array[j - 1] > target:
            ind = j - 1
            break
    return ind