It shall be the duty of any person sentenced to give bond to keep the peace, to present two sufficient sureties who shall undertake that such person will not commit the offense sought to be prevented, and that in case such offense be committed they will pay the amount determined by the court in its judgment, or otherwise to deposit such amount in the office of the clerk of the court to guarantee said undertaking.
The court shall determine, according to its discretion, the period of duration of the bond.
Should the person sentenced fail to give the bond as required he shall be detained for a period which shall in no case exceed six months, if he shall have been prosecuted for a grave or less grave felony, and shall not exceed thirty days, if for a light felony.