human
I wrote the below code

    def find_local_maxima_idx(hist):
        maximum_idxs = list()
        direction = 1
        for i in range((hist.shape[0] - 1)):
            if (direction > 0):
                if (hist[(i + 1)] < hist[i]):
                    direction = (-1)
                    maximum_idxs.append(i)
            elif (hist[(i + 1)] > hist[i]):
                direction = 1
        return maximum_idxs
    (hist, bin_centers) = histogram(image.ravel(), nbins)
    smooth_hist = np.copy(hist).astype(np.float64)
    for counter in range(max_iter):
        smooth_hist = ndi.uniform_filter1d(smooth_hist, 3)
        maximum_idxs = find_local_maxima_idx(smooth_hist)
        if (len(maximum_idxs) < 3):
            break
    if (len(maximum_idxs) != 2):
        raise RuntimeError('Unable    to    find    two    maxima    in    histogram')
    elif (counter == (max_iter - 1)):
        raise RuntimeError('Maximum    iteration    reached    for    histogramsmoothing')
    threshold_idx = np.argmin(smooth_hist[maximum_idxs[0]:(maximum_idxs[1] + 1)])
    return bin_centers[(maximum_idxs[0] + threshold_idx)]

What's a good function header?

Can you provide a Python program to find    two    maxima    in    histogram')?
assistant
#Here is Python program to find    two    maxima    in    histogram')
.

def threshold_minimum(image, nbins=256, max_iter=10000):