Whenever any sum of money is so deposited in lieu of a bond, recognizance or undertaking the person depositing it shall be entitled to a receipt therefor, stating that such sum of money has been deposited and is held for the same purpose as would have been specified and conditioned in the bond, recognizance or undertaking in lieu whereof such sum of money is so deposited.