def METHOD_NAME(points, surf, smooth=False, smooth_k=0.1, tree=None):
    """
    Calculate the distance to a mesh from points in a tabular dataset 
    Parameters
    ----------
        points : np.array
            3D point cloud to fit (nm).
        surf : PYME.experimental._triangle_mesh
            Isosurface
        smooth : bool
            Smooth distance to mesh?
        smooth_k : float
            Smoothing constant, by default 0.1 = smoothed by 1/10 nm
        tree : scipy.spatial.cKDTree
            Optionally pass a tree of face centers to use if calling
            this function multiple times.
    """
    if tree is None:
        import scipy.spatial
        # Create a list of face centroids for search
        face_centers = surf._vertices['position'][surf.faces].mean(1)
        # Construct a kdtree over the face centers
        tree = scipy.spatial.cKDTree(face_centers)
    # Get M closet face centroids for each point
    M = 5
    _, _faces = tree.query(points, k=M, workers=-1)
    # Get position representation
    _v = surf.faces[_faces]
    v = surf._vertices['position'][_v]  # (n_points, M, (v0,v1,v2), (x,y,z))
    # the negative reverses the norpa sign flip
    # trick 2 from https://iquilezles.org/www/articles/interiordistance/interiordistance.htm
    return -sdf_min(triangle_sdf(points, v), smooth=smooth, k=smooth_k)