Equation that determines the restriction on lagrange multipier

def restriction(lam, mu, orbitals, U, beta):
    """Equation that determines the restriction on lagrange multipier"""
    return 2*orbitals*fermi_dist(-(mu + lam), beta) - expected_filling(-1*lam, orbitals, U, beta)