In no event shall a prisoner bring a civil action or appeal a judgment in a civil action or proceeding if the prisoner has, on two (2) or more prior occasions, while incarcerated or detained in any state, local or private correctional facility, brought an action or appeal in a court of this state that was dismissed on any ground set forth in section 19-4209(1)(a) through (d), Idaho Code, unless:
Idaho Code § 19-4221