Characterization of quasi-alternating Montesinos links