Nothing in sections 589.01 to 589.30 is to be construed to prevent a court from issuing a writ of habeas corpus necessary or proper to bring an inmate before it or an inferior court for trial, an omnibus hearing, arraignment, appearance, or to be examined as a witness in a civil or criminal action or proceeding.