Section 24. A district attorney, in the name of the commonwealth, may contract such bills for stationery, experts, travel outside of the commonwealth by witnesses required by the commonwealth in the prosecution of cases, for necessary expenses incurred by himself or by officers and others under his direction in going outside of the commonwealth for the purpose of searching for or bringing back for trial persons under indictment or against whom complaints are pending in his district, and for such other expenses as may in his opinion be necessary for the proper conduct of his office in the investigation of or preparation and trial of criminal cases; and all such bills shall be paid by the commonwealth upon a certificate by the district attorney that they were necessarily incurred in the proper performance of his duty.