In any proceeding the party entitled to recover costs may include therein such reasonable sum as was paid to such surety insurer as premium for any bond or undertaking required therein, and as may be allowed by the court having jurisdiction of such proceeding.