If a plaintiff who has once dismissed an action in any court commences an action based upon or including the same claim against the same defendant, the court may make such order for the payment of costs of the action previously dismissed as it may deem proper and may stay the proceedings in the action until the plaintiff has complied with the order.
SDCL 15-6-41(d)