Simple tweaking for calculated fields

I love tweak frappe framework, to facilitate my work!

I´m sharing a function that I developed to play, about how we can drastically reduce the requirement of excess of lines of codes, when we hace a calculated field, that depends of a lot of other fields!

My function takes 44 lines of code!, I know that It´s too much!
But after introduce this in my development workflow, a lot of codes, are reduced drastically!

One briefe example, starts into the line 67 of the file!
It’s how we compute one of the Brazilian Taxes!

Using this function, I reduced the requirements of 164 lines of codes, for only 7!