def contour_length_py(verts):
    """
    Compute the length of a contour.  Copied from
    https://arachnoid.com/area_irregular_polygon/
    
    Parameters
    ----------
    verts : array_like
        2D shape (N,2) array of vertices. Uses scikit image convetions
        (j,i indexing)
        
    Returns
    ----------
    Perimeter : float
        Perimeter of a contour by verts.
    """
    p = 0
    ox, oy = verts[0]
    
    for x, y in verts[1:]:
        p += abs((x - ox) + (y - oy) * 1j)
        ox, oy = x, y
    
    return p