recreated fif as a self contained python script