find hierarchical shareholders relationships: refactor nested if in python
I want to find shareholder relationships between companies.
in the below example ‘Person 1’ have directly 50% of ‘Company 1’ shares then need to check if ‘Company 1’ also have share’s of other companies. ‘Company 1’ have 50% of ‘Company 2’ share and 20% of ‘Company 3’. it means ‘Person 1’ indirectly have some share in ‘Company 2’ and ‘Company 3’.