I'm glad they got caught. That will 'teach them a lesson'! [=they will learn that they should not do that again]
We 'learned our lesson' the hard way. [=we learned from an unpleasant experience]
They studied the 'lessons' [='teachings'] of the great philosophers.
(..) marries the Queen and becomes ruler of Lydia for years. The end. Shall l spin the bottle? So, Geoffrey let that be a lesson to you. - D'Agostino! - D'Agostino! Are you ssleep? Yes. No. l'm dropping off. (..)1996 The English Patient