Legal basement apartments, built new or brought up to code

Already built, and it was never permitted? We can bring it up to code