def closest_pair_strip(cluster_list, horiz_center, half_width):
    """
    Helper function to compute the closest pair of clusters in a vertical strip

    Input: cluster_list is a list of clusters produced by fast_closest_pair
    horiz_center is the horizontal position of the strip's vertical center line
    half_width is the half the width of the strip (i.e; the maximum horizontal distance
    that a cluster can lie from the center line)

    Output: tuple of the form (dist, idx1, idx2) where the centers of the clusters
    cluster_list[idx1] and cluster_list[idx2] lie in the strip and have minimum distance dist.
    """
    strip = list()
    for cluster in cluster_list:
        if abs(cluster.horiz_center()-horiz_center) < half_width:
            strip.append((cluster, cluster_list.index(cluster)))
    strip.sort(key = lambda cluster: cluster[0].vert_center())
    length = len(strip)
    dist, idx1, idx2 = float('inf'), -1, -1

    for idx_u in range(length-1):
        for idx_v in range(idx_u+1, min(idx_u+4, length)):
            uv_dist = strip[idx_u][0].distance(strip[idx_v][0])
            if uv_dist < dist:
                dist = uv_dist
                if strip[idx_u][1] < strip[idx_v][1]:
                    idx1 = strip[idx_u][1]
                    idx2 = strip[idx_v][1]
                else:
                    idx1 = strip[idx_v][1]
                    idx2 = strip[idx_u][1]

    return (dist, idx1, idx2)