def smooth(polylines):
    """
    smooth every polyline using spline interpolation
    """
    for c in polylines:
        if len(c) < 9:
            # smoothing wouldn't make sense here
            continue
        x = c[:, 0]
        y = c[:, 1]

        t = np.arange(x.shape[0], dtype=float)
        t /= t[-1]
        x = UnivariateSpline(t, x)(t)
        y = UnivariateSpline(t, y)(t)
        c[:, 0] = x
        c[:, 1] = y
smooth every polyline using spline interpolation