On holding the defendant to answer, the magistrate may take from each of the material witnesses examined before him on the part of the people a written undertaking to the effect that he will appear and testify at the court to which the depositions and statements are to be sent, or that he will forfeit the sum of $500.00.
Idaho Code § 19-820