At any time before the order is made, the defendant may apply to the court for an order to stay the issuance of the warrant for a period not exceeding six months to allow the defendant to abate the nuisance. The court may grant the stay if the defendant gives an undertaking to the plaintiff in a sufficient amount and with satisfactory sureties that the issuance will be abated within the time and in the manner specified in the order. If the defendant fails to abate the nuisance within the time specified, an order directing the issuance of the warrant for the abatement of the nuisance may be made.