Any court, by order, may require an officer having the custody of any person confined in any prison in this state to produce such person before it for oral examination in the county where the person is imprisoned. In all other cases, except as otherwise provided in section 31-03-18, such person must be examined by deposition.
N.D.C.C. § 31-03-16