Whenever a United States marshal dies, is removed from office, or the term of his commission expires, after levying on realty or any interest therein under a writ of execution issued by a court of the United States, and before sale or other final disposition thereof, like process shall issue to the succeeding marshal and the same proceedings shall be had as if such contingency had not occurred.
Whenever any such contingency arises after a marshal has sold any realty or interest therein and before a deed is executed, the court may, on application by the purchaser, or the plaintiff in whose action the sale was made, setting forth the facts of the case and the reason why the title was not perfected by such marshal, order the succeeding marshal to perfect the title and execute a deed to the purchaser, upon payment of the purchase money and unpaid costs.