def _interp_internal_from_weight(arr, axis, left, right, lhs_idx, rhs_idx,
    frac, left_idx, right_idx):
    """ numpy ==> numpy """
    if arr.ndim > 1:
        arr = arr.swapaxes(axis, 0)
        _frac = frac[(slice(None),) + (None,) * (arr.ndim - 1)]
    else:
        _frac = frac
    vleft = arr[lhs_idx]
    vright = arr[rhs_idx]
    newval = vleft + _frac * (vright - vleft)
    newval[left_idx] = left
    newval[right_idx] = right
    if arr.ndim > 1:
        newval = newval.swapaxes(axis, 0)
    return newval
