§ 6515. Undertaking for cancellation of notice of pendency; security by plaintiff. In any action other than a foreclosure action as defined in subdivision (b) of section 6516 of this article or for partition or dower, the court, upon motion of any person aggrieved and upon such notice as it may require, may direct any county clerk to cancel a notice of pendency, upon such terms as are just, whether or not the judgment demanded would affect specific real property, if the moving party shall give an undertaking in an amount to be fixed by the court, and if:
1. the court finds that adequate relief can be secured to the plaintiff by the giving of such an undertaking; or
2. in such action, the plaintiff fails to give an undertaking, in an amount to be fixed by the court, that the plaintiff will indemnify the moving party for the damages that he or she may incur if the notice is not cancelled.