Any person convicted of a violation of Section 11353, 11353.5, 11361, 11380, or 11380.5 of the Health and Safety Code who has previously served two or more prior separate prison terms, as defined in Section 667.5, for a violation of Section 11353, 11353.5, 11361, 11380, or 11380.5 of the Health and Safety Code, may be punished by imprisonment in the state prison for life and shall not be eligible for release on parole for 17 years, or the term determined by the court pursuant to Section 1170 for the underlying conviction, including any enhancement applicable under Chapter 4.5 (commencing with Section 1170) of Title 7 of Part 2, whichever is greatest. The provisions of Article 2.5 (commencing with Section 2930) of Chapter 7 of Title 1 of Part 3 shall apply to reduce any minimum term in a state prison imposed pursuant to this section, but the person shall not otherwise be released on parole prior to that time. No prior prison term shall be used for this determination which was served prior to a period of 10 years in which the person remained free of both prison custody and the commission of an offense which results in a felony conviction. As used in this section, a commitment to the Department of the Youth Authority after conviction for a felony shall constitute a prior prison term. The term imposed under this section shall be imposed only if the prior prison terms are alleged under this section in the accusatory pleading, and either admitted by the defendant in open court, or found to be true by the jury trying the issue of guilt or by the court where guilt is established by a plea of guilty or nolo contendere or by a trial by the court sitting without a jury.
Ca. Pen. Code § 667.75