def plane_err(data, coeffs):
    'Calculates the total squared error of the data wrt a plane.\n\n       The data should be a list of points. coeffs is an array of\n       3 elements - the coefficients a,b,c in the plane equation\n       ax+by+c = 0.\n\n       Arguments:\n       data: A numpy array of points.\n       coeffs: The coefficients of the plane ax+by+c=0.\n\n       Returns: The total squared error wrt the plane defined by ax+by+cz = 0.'
    (a, b, c) = coeffs
    return (np.sum(((((a * data[:, 0]) + (b * data[:, 1])) + (c * data[:, 2])) ** 2)) / (((a ** 2) + (b ** 2)) + (c ** 2)))
Calculates the total squared error of the data wrt a plane.

The data should be a list of points. coeffs is an array of
3 elements - the coefficients a,b,c in the plane equation
ax+by+c = 0.

Arguments:
data: A numpy array of points.
coeffs: The coefficients of the plane ax+by+c=0.

Returns: The total squared error wrt the plane defined by ax+by+cz = 0.
def plane_err(data, coeffs):
    'Calculates the total squared error of the data wrt a plane.\n\n       The data should be a list of points. coeffs is an array of\n       3 elements - the coefficients a,b,c in the plane equation\n       ax+by+c = 0.\n\n       Arguments:\n       data: A numpy array of points.\n       coeffs: The coefficients of the plane ax+by+c=0.\n\n       Returns: The total squared error wrt the plane defined by ax+by+cz = 0.'
    (a, b, c) = coeffs
    return (np.sum(((((a * data[:, 0]) + (b * data[:, 1])) + (c * data[:, 2])) ** 2)) / (((a ** 2) + (b ** 2)) + (c ** 2)))