fibd - solution from python
restructure