All trusts established for any municipal purpose shall be used and contained in accordance with the terms of such trust subject to the cy pres doctrine. The council may in its discretion receive and hold any property in trust for any municipal purpose and shall apply the same to the execution of such trust and for no other purposes, except in cases where the cy pres doctrine shall apply.