<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def fisher_mean(data):
 """ Calculates the Fisher mean and associated parameter from a di_block Parameters di_block : a nested list of [dec,inc] or [dec,inc,intensity] Returns ------- fpars : dictionary containing the Fisher mean and statistics dec : mean declination inc : mean inclination r : resultant vector length n : number of data points k : Fisher k value csd : Fisher circular standard deviation alpha95 : Fisher circle of 95% confidence """

    R, Xbar, X, fpars = 0, [0, 0, 0], [], {}
    N = len(data)
    if N < 2:
        return fpars
    X = dir2cart(data)
    for i in range(len(X)):
        for c in range(3):
            Xbar[c] += X[i][c]
    for c in range(3):
        R += Xbar[c]**2
    R = np.sqrt(R)
    for c in range(3):
        Xbar[c] = Xbar[c]/R
    dir = cart2dir(Xbar)
    fpars["dec"] = dir[0]
    fpars["inc"] = dir[1]
    fpars["n"] = N
    fpars["r"] = R
    if N != R:
        k = (N - 1.) / (N - R)
        fpars["k"] = k
        csd = 81./np.sqrt(k)
    else:
        fpars['k'] = 'inf'
        csd = 0.
    b = 20.**(1./(N - 1.)) - 1
    a = 1 - b * (N - R) / R
    if a < -1:
        a = -1
    a95 = np.degrees(np.arccos(a))
    fpars["alpha95"] = a95
    fpars["csd"] = csd
    if a < 0:
        fpars["alpha95"] = 180.0
    return fpars