Just like with intestines falling out, this is actually not as dangerous as it sounds. As long as the lungs (or other organs) aren't injured and you put them back in and seal the wound quickly you should in theory be just fine. Assuming you avoid/survive the infections of course. It looks very horrifying and dramatic, but is far less dangerous than it seems.