def METHOD_NAME(self, X):
    """Find the K-neighbors of a point.
    Returns indices and weights of each point.
    Parameters
    ----------
    X : 3D np.ndarray of shape = (n_cases, n_channels, n_timepoints) or list of
    shape[n_cases] of 2D arrays shape (n_channels,n_timepoints_i)
            If the series are all equal length, a numpy3D will be passed. If
            unequal, a list of 2D numpy arrays is passed, which may have
            different lengths.
    Returns
    -------
    ind : array
        Indices of the nearest points in the population matrix.
    ws : array
        Array representing the weights of each neighbor.
    """
    distances = np.array(
        [
            self.metric_(X, self.X_[j], **self._distance_params)
            for j in range(len(self.X_))
        ]
    )
    # Find indices of k nearest neighbors using partitioning:
    # [0..k-1], [k], [k+1..n-1]
    # They might not be ordered within themselves,
    # but it is not necessary and partitioning is
    # O(n) while sorting is O(nlogn)
    closest_idx = np.argpartition(distances, self.n_neighbors)
    closest_idx = closest_idx[: self.n_neighbors]
    if self.weights == "distance":
        ws = distances[closest_idx]
        ws = ws**2
        # Using epsilon ~= 0 to avoid division by zero
        ws = 1 / (ws + np.finfo(float).eps)
    elif self.weights == "uniform":
        ws = np.repeat(1.0, self.n_neighbors)
    else:
        raise Exception(f"Invalid kNN weights: {self.weights}")
    return closest_idx, ws