<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _inertia_from_labels(X, centers, labels):
 """Compute inertia with cosine distance using known labels. """

    n_examples, n_features = X.shape
    inertia = np.zeros((n_examples,))
    for ee in range(n_examples):
        inertia[ee] = 1 - X[ee, :].dot(centers[int(labels[ee]), :].T)

    return np.sum(inertia)