When any person is required by any court or officer to execute a bond with or without sureties, such court or officer may, except in the case of a bond for good behaviour, permit him to deposit a sum of money or Government promissory notes to such amount as the court of officer may if in lieu of executing such bond.