DEDUCTION OF THE KADOMETSEV-PETVIASHVILI EQUATION FOR MAGNETOSONIC WAVES