A law requiring a bond or undertaking with sureties to be given by any person is construed to permit in lieu thereof a bond of indemnity or surety bond for the amount of such bond or undertaking, given by an indemnity or surety company authorized to do business in this state, and approved by the proper authority.