Penal Code PC § 859a

(a) If the public offense charged is a felony not punishable with death, the magistrate shall immediately upon the appearance of counsel for the defendant read the complaint to the defendant and ask him or her whether he or she pleads guilty or not guilty to the offense charged therein and to a previous conviction or convictions of crime if charged.  While the charge remains pending before the magistrate and when the defendant’s counsel is present, the defendant may plead guilty to the offense charged, or, with the consent of the magistrate and the district attorney or other counsel for the people, plead nolo contendere to the offense charged or plead guilty or nolo contendere to any other offense the commission of which is necessarily included in that with which he or she is charged, or to an attempt to commit the offense charged and to the previous conviction or convictions of crime if charged upon a plea of guilty or nolo contendere.  The magistrate may then fix a reasonable bail as provided by this code, and upon failure to deposit the bail or surety, shall immediately commit the defendant to the sheriff.  Upon accepting the plea of guilty or nolo contendere the magistrate shall certify the case, including a copy of all proceedings therein and any testimony that in his or her discretion he or she may require to be taken, to the court in which judgment is to be pronounced at the time specified under subdivision (b), and thereupon the proceedings shall be had as if the defendant had pleaded guilty in that court.  This subdivision shall not be construed to authorize the receiving of a plea of guilty or nolo contendere from any defendant not represented by counsel.  If the defendant subsequently files a written motion to withdraw the plea under Section 1018 , the motion shall be heard and determined by the court before which the plea was entered.

(b) Notwithstanding Section 1191 or 1203 , the magistrate shall, upon the receipt of a plea of guilty or nolo contendere and upon the performance of the other duties of the magistrate under this section, immediately appoint a time for pronouncing judgment in the superior court and refer the case to the probation officer if eligible for probation, as prescribed in Section 1191 .