<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def calc_z(bands, filling, interaction, hund_cu, name):
 """Calculates the quasiparticle weight of degenerate system of N-bands at a given filling within an interaction range and saves the file"""


    while True:
        try:
            data = np.load(name+'.npz')
            break
        except IOError:
            dopout = []
            for dop in filling:
                slsp = Spinon(slaves=2*bands, orbitals=bands, \
                             hopping=[0.5]*2*bands, populations=[dop]*2*bands)
                dopout.append(solve_loop(slsp, interaction, hund_cu)[0][0])
            np.savez(name, zeta=dopout, u_int=interaction, doping=filling, hund=hund_cu)

    return data