1016.5. (a) Prior to acceptance of a plea of guilty or nolo contendere to any offense punishable as a crime under state law, except offenses designated as infractions under state law, the court shall administer the following advisement on the record to the defendant:
If you are not a citizen, you are hereby advised that conviction of the offense for which you have been charged may have the consequences of deportation, exclusion from admission to the United States, or denial of naturalization pursuant to the laws of the United States.
(b) Upon request, the court shall allow the defendant additional time to consider the appropriateness of the plea in light of the advisement as described in this section. If, after January 1, 1978, the court fails to advise the defendant as required by this section and the defendant shows that conviction of the offense to which defendant pleaded guilty or nolo contendere may have the consequences for the defendant of deportation, exclusion from admission to the United States, or denial of naturalization pursuant to the laws of the United States, the court, on defendant's motion, shall vacate the judgment and permit the defendant to withdraw the plea of guilty or nolo contendere, and enter a plea of not guilty. Absent a record that the court provided the advisement required by this section, the defendant shall be presumed not to have received the required advisement.
(c) With respect to pleas accepted prior to January 1, 1978, it is not the intent of the Legislature that a court's failure to provide the advisement required by subdivision (a) of Section 1016.5 should require the vacation of judgment and withdrawal of the plea or constitute grounds for finding a prior conviction invalid. Nothing in this section, however, shall be deemed to inhibit a court, in the sound exercise of its discretion, from vacating a judgment and permitting a defendant to withdraw a plea.
(d) The Legislature finds and declares that in many instances involving an individual who is not a citizen of the United States charged with an offense punishable as a crime under state law, a plea of guilty or nolo contendere is entered without the defendant knowing that a conviction of such offense is grounds for deportation, exclusion from admission to the United States, or denial of naturalization pursuant to the laws of the United States. Therefore, it is the intent of the Legislature in enacting this section to promote fairness to such accused individuals by requiring in such cases that acceptance of a guilty plea or plea of nolo contendere be preceded by an appropriate warning of the special consequences for such a defendant which may result from the plea. It is also the intent of the Legislature that the court in such cases shall grant the defendant a reasonable amount of time to negotiate with the prosecuting agency in the event the defendant or the defendant's counsel was unaware of the possibility of deportation, exclusion from admission to the United States, or denial of naturalization as a result of conviction. It is further the intent of the Legislature that at the time of the plea no defendant shall be required to disclose his or her legal status to the court.