Whenever any person is arrested for a violation of the Livestock Brand Act or section 54-415 punishable as a misdemeanor, the arresting peace officer shall, except as otherwise provided in this section, take the name and address of such person and the license number of his or her motor vehicle. The peace officer shall issue a summons or otherwise notify him or her in writing to appear at a time and place to be specified in such summons or notice. Such time shall be at least five days after such arrest, unless the person arrested demands an earlier hearing. Such person, if he or she so desires, has a right to an immediate hearing or a hearing within twenty-four hours at a convenient hour, such hearing to be before a magistrate within the county where such offense was committed. The peace officer shall thereupon, and upon the giving by such person of his or her written promise to appear at such time and place, forthwith release him or her from custody. Any person refusing to give such written promise to appear shall be taken immediately by the arresting peace officer before the nearest or most accessible magistrate.