Every person who has been convicted in any other state, government, country, or jurisdiction of an offense for which, if committed within this state, that person could have been punished under the laws of this state by imprisonment in the state prison, is punishable for any subsequent crime committed within this state in the manner prescribed by law and to the same extent as if that prior conviction had taken place in a court of this state. The application of this section includes, but is not limited to, all statutes that provide for an enhancement or a term of imprisonment based on a prior conviction or a prior prison term or a term pursuant to subdivision (h) of Section 1170.
Ca. Pen. Code § 668