eq 41 is
logL(k) max = b**2 k/4a_k
which is exactly the formula you coded in L144.
Eqn 19 is says
log L(k)_max + N(k) = N(k)( logN(k) − logT(k))
which is coded in 
https://github.com/astroML/astroML/blob/master/astroML/density_estimation/bayesian_blocks.py#L76