mbbcalc.py implementation