Python code used at FMO.