The final, triumphant song from Monty Python's 1979 film Life of Brian: in fact the only song after the Bassey-esque opening theme. It was so good it went into the charts, it's a popular choice to be played at funerals, and the phrase has entered the language.

Brian of Nazareth, apprentice member of the People's Front of Judaea (or is it the...?), has been captured and sentenced to crucifixion, along with an endless number of other criminals and riff-raff. He depends on the PFJ to rescue him, but they arrive as a deputation to praise his martyrdom. His lover Judith admires him for it, and his mother is disgusted. But no one helps him. He is in utter despair, dying on the cross.

Then the prisoner crucified next to him (played by Eric Idle, composer of the song), rallies him with the words, "Cheer up, Brian. You know what they say." He then proceeds to explain that when things are looking bad it can really make you mad, but instead of grumbling or cursing it helps if you just give a little whistle. This he then does.

You can find the illegally-held lyrics on one of countless sites if you look, so we don't need them all here.

The song, with music and whistling, is gradually taken up by the whole crowd, a whole hillside of people on crosses, swaying and bopping jauntily to the infectious tune and sentiments. Life is absurd, and we all face death, so...

So always look on the bright side of death!
Just before you draw your terminal breath.
Life's a piece of shit,0
When you look at it.
I have read three things I can't positively confirm about it. One1, that Eric Idle spontaneously composed it while up on the cross during filming, because the cast and extras were grumbling about the heat and discomfort; two2, that it's now one of the most popular pieces of music requested at funerals; and three3, that sailors on HMS Coventry sang it as they waited for rescue or drowning in the Falklands War.

0. -- obviously it can't have been improvised during the scenes we see; but recall Idle also played the first prisoner who answered "I'm Brian" when the pardon was brought, so there must have been many screen days stuck up on crosses before the ending we now know.
2. see Google, passim, for plenty of anecdata but nothing definite
3. story repeated in the node HMS Coventry
4. or "spit", in the 1991 Top of the Pops performance; or just "bleep" on some stations

And always look on the bright side of life...