Toy Python implementation of the BCALM algorithm