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.
(..) than for you to think me cruel. Then let him go. Hold out the hand that has defied me. Let this serve as a lesson to all Vikings. Take him to his ship and cast him adrift. Why do we wait? Because of a slave... (..)1958 The Vikings