"Deserved Punishment" is a type of excuse claim people can use in an attempt to justify a family of actio types that a person with good desires would normally be averse to doing.
Specifically, punishment involves intentionally harming another. People generally have many and strong reasons to promote an aversion to intentionally harming others. However, people generally have reason to allow exceptions where this type of action promotes a more moral community and provides a defense against villainy.
Morality itself uses punishment as a way of molding desires - not only for those punished but those who become aware of the punishment. Punishment (as opposed to simple violence) carries an intrinsic message of condemnation. If a person is convicted of a crime, punishment is not a purely mechanical application of violence against that person. It is a declaration that "People like you deserve to be treated this way. You - and those like you - are contemptible."
This means that people can excuse acts of harsh treatment - acts that people generally have many and strong reasons to condemn - by saying, "He deserved it."
Another phrase commonly used when appealing to the "deserved punishment" excuse is, "I am going to teach him a lesson." Note here that desirism can explain the idea that this type of behavior actually is an example of "teaching a moral lesson." This is not just a figure of speech. It is an accurate description of what condemnation and just punishment are for - teaching moral lessons (molding malleable desires).
Violence is also often needed as a form of defense against villains. Complete pacifism turns a community into a feeding ground for villains. Yet, self defense is also only legitimate against those who act wrongly. Defending oneself against properly authorized legal authorities is not an excusable behavior.
Deserved punishment is also a much abused excuse. A person lies to the insurance company and justifies it in his own mind as an act of punishment against a greedy corporation. A rapist or a man who beats his wife and children will tell them (and himself) that they deserve to be treated in such a way. The Jews deserved the Holocaust for being a part of an economic conspiracy to enslave the German people, and the Bible reports how the dark-skinned descendants of Ham deserve to be enslaved as divine punishment for Ham's actions.
A valid application of the "justified punishment" excuse requires that the behavior in question be of a type that people in general actually do have real reasons to condemn and punishment. This has to be defensible by examinng those reasons for action and showing how the punishment in question serves those ends.
However, the common abuses of this form of excuse argues that people have reason to promote aversions to its use when not confined to certain guidelines. People generally have many and strong reasons to insist on a presumption of innocence, on the evidence being heard by an impartial jury, and of the violence being proportional to the wrong - all of these worked out in terms of the reasons that people generally have to use these tools to teach these lessons. People who do not work within these limits cannot justify their use of the excuse of deserved punishment.
These are constraints to the xcuse of "deserved punishment" that private acts of violence can seldom, if ever, meet.