California Code
CHAPTER 2 - Means of Production
Section 1995.

1995. If the witness be a prisoner, confined in a jail within this state, an order for his examination in the jail upon deposition, or for his temporary removal and production before a court or officer may be made as follows:

1. By the court itself in which the action or special proceeding is pending, unless it be a small claims court.

2. By a justice of the Supreme Court, or a judge of the superior court of the county where the action or proceeding is pending, if pending before a small claims court, or before a judge or other person out of court.

(Amended by Stats. 1977, Ch. 1257.)