Work on 03_fip.py

Continuing the translation from R script to python