When an interest in real property is conveyed by deed to a person on a trust which is unenforceable on account of the statute of frauds and the intended trustee or his successor in interest still holds title but refuses to carry out the trust on account of the statute of frauds, the intended trustee or his successor in interest, except to the extent that the successor in interest is a bona fide purchaser of a legal interest in the real property in question, shall be under a duty to convey the interest in real property to the settlor or his successor in interest. A court having jurisdiction may prescribe the conditions upon which the interest shall be conveyed to the settlor or his successor in interest.
SDCL 55-4-17