Part of the permitting process is the inspections. If there's electrical there, then there probably should have been an electrical inspection. There may also have been a framing inspection needed as well. If it's already sheetrocked, then those two inspections can be hard to do. There's also a permit fee, and, at least where I live, I think there's also an additional fee for stuff you should have permitted ahead of time but got permitted after the fact.
Since you're only in escrow, I think it'd be reasonable to either ask the seller to take care of bringing it up to code, or reserve some additional funds from seller in escrow to take care of bringing it up to code, depending on whether you care to wait for the problems to be fixed before you move in or are OK with it being solved after you move in.