Begin to end of a pipe network using mepover and python

Hello Community:
I am trying to make a tool that sum the pressure drop of each element from the begining of the mainbranch until the end, with every possible route of pipes. I have some of the information with MEPover package but i can’t create a python code that classifies the information so the last pipe of each branch has a parameter with the sum of every pressure drop of every element involved and another parameter with the id’s of those elements. In fact these exercise it could be very usefull to know not just these but maybe to create an automatic P&ID of a network of pipes or ducts.
I think that these problem has to be resolved with python but i don`t know how to do, so if you have some tutorials o tools that might help to figure out how the pipes networks links each element it will be something that i will want to work with the community and of course open source. branch pipe 2.dyn (183.4 KB)