<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def bhattacharyya_distance(pca1,pca2):
 """ A measure of the distance between two probability distributions """

    u1 = pca1.coefficients
    s1 = pca1.covariance_matrix
    u2 = pca2.coefficients
    s2 = pca2.covariance_matrix

    sigma = (s1+s2)/2

    assert all(u1 > 0)
    assert all(u2 > 0)
    assert all(s1.sum(axis=1) > 0)
    assert all(s2.sum(axis=1) > 0)

    _ = 1/8*dot((u1-u2).T, N.linalg.inv(sigma),u1-u2)
    _ += 1/2*N.log(N.linalg.det(sigma)/(N.linalg.det(s1)*N.linalg.det(s2)))
    return _