No person sentenced under California law who is committed or transferred to an institution outside of this state shall be competent to testify for the prosecution in any criminal proceeding in this state unless counsel for each defendant in such proceeding is notified that the prosecution may call the person as a witness and is given an opportunity to interview the person no less than 10 days before the commencement of the proceeding or, in the event the prosecution is not at that time considering the possibility of using such testimony, the notice and opportunity for interview shall be given at the earliest possible time. Nothing in this section shall be construed to compel the prisoner to submit to such an interview.
Ca. Pen. Code § 11197