I think a better metric is would I wish my grandma be treated this way? A society should be judged by how it treats those that are the weakest.
"A society is judged by how it treats its weakest", "would I want $GOOD_PERSON to fall victim to this" -- those sound nice, but don't translate into a practical metric for appropriately navigating real moral dilemmas.
[1] I know the lectures about the evils of mass incarceration; those don't prove that no one should be imprisoned.
This may permit consideration of the relative social value of the punishment, alloyed with the emotional bias provided by the context.