Initial conversion of BSM code to Python