I discussed this theme in my medium blog(https://medium.com/@imedkrisna/extending-a-simple-2-period-consumption-problem-the-third-period-afterlife-9223cf5467d). I recycle this with a bit of an addition to a more generalised utility function and exploiting python this time so I don’t have to do it by hand, which is nice.