Pure Python port of the Matlab BRML toolbox of David Barber.