You don't, the bank does and if they cant' my advice to you is to walk away form the deal and not assume their problem. You need to bear in mind that the municipality where the property resides has every right to force the owner of the property to re-do all the work to conform to today's codes, even if the work met the codes at the time the work was done. Before I would even consider doing this I'd want the town or city building inspectors to come out and tell me exactly what they would require to issue a permit so you have a very clear understanding of what it's going to take; then it's a matter of evaluating the risk versus the reward.
Buyers still mistakenly believe that buying foreclosures is a way to get a deal, with more than 25 years of experience buying, selling, and flipping homes I can assure you that less than 1 in 200 is actually a good deal. I've attached a link below for more information on foreclosures which I hope you find helpful.... more