If the court finds that the fulfillment of the purposes are or have become impossible, inexpedient, or unlawful, the court shall make an order directing that the trust be administered in such manner as, in the judgment of the court, will, as nearly as can be, accomplish the general purposes, the objects, and intentions of the trustor.
SDCL 55-1-21.3