2. A court shall not, at the request of any prisoner in a county, city or town jail, issue an order which affects the conditions of confinement of the prisoner unless, except as otherwise provided in this subsection, the court provides the sheriff, chief of police or town marshal having control over the prisoner with: (a) Sufficient prior notice of the court's intention to enter the order. Notice by the court is not necessary if the prisoner has filed an action with the court challenging his or her conditions of confinement and has served a copy of the action on the sheriff, chief of police or town marshal.(b) An opportunity to be heard on the issue.As used in this subsection, "conditions of confinement" includes, but is not limited to, a prisoner's access to the law library, privileges regarding visitation and the use of the telephone, the type of meals provided to the prisoner and the provision of medical care in situations which are not emergencies.