Cal. Penal Code § 1170.12
(a) Notwithstanding any other law, if a defendant has been convicted of a felony and it has been pled and proved that the defendant has one or more prior serious or violent felony convictions, as defined in subdivision (b), the court shall adhere to each of the following:
(b) Notwithstanding any other law and for the purposes of this section, a prior serious or violent conviction of a felony is defined as:
(1) Any offense defined in subdivision (c) of Section 667.5 as a violent felony or any offense defined in subdivision (c) of Section 1192.7 as a serious felony in this state. The determination of whether a prior conviction is a prior serious or violent felony conviction for purposes of this section shall be made upon the date of that prior conviction and is not affected by the sentence imposed unless the sentence automatically, upon the initial sentencing, converts the felony to a misdemeanor. The following dispositions shall not affect the determination that a prior serious or violent conviction is a serious or violent felony for purposes of this section:
(3) A prior juvenile adjudication constitutes a prior serious or violent felony conviction for the purposes of sentence enhancement if it meets all of the following criteria:
(B) The prior offense is either of the following:
(c) For purposes of this section, and in addition to any other enhancements or punishment provisions that may apply, the following apply if a defendant has one or more prior serious or violent felony convictions:
(2)
(A) Except as provided in subparagraph (C), if a defendant has two or more prior serious or violent felony convictions, as defined in subdivision (b), that have been pled and proved, the term for the current felony conviction shall be an indeterminate term of life imprisonment with a minimum term of the indeterminate sentence calculated as the greatest of any of the following:
(C) If a defendant has two or more prior serious or violent felony convictions as defined in subdivision (c) of Section 667.5 or subdivision (c) of Section 1192.7 that have been pled and proved, and the current offense is not a felony described in paragraph (1) of subdivision (b), the defendant shall be sentenced pursuant to paragraph (1) of subdivision (c), unless the prosecution pleads and proves any of the following:
(iv) The defendant suffered a prior conviction, as defined in subdivision (b), for any of the following serious or violent felonies:
(d)