(a) The supreme court or a court of appeals may issue a writ of mandamus to compel the performance of any duty imposed by law in connection with the holding of an election or a political party convention, regardless of whether the person responsible for performing the duty is a public officer.
(b) The court of criminal appeals may issue a writ of mandamus to compel the performance of any duty imposed by law in connection with the provision, sequestration, transfer, or impoundment of evidence in or records relating to a criminal investigation conducted under this code or conducted in connection with the conduct of an election or political party convention. If a writ of mandamus is issued under this subsection, it shall include an order requiring the provision, sequestration, transfer, or impoundment of the evidence or record.