Part of that involves trying to figure out how much of a danger the person is to society, and an important input to that is character witnesses (both favorable and unfavorable).
If a friend of mine was convicted of a crime and asked me for a character letter, I would probably write one giving an honest and accurate report of what I personally knew of them.
I don't see how that would be hypocritical, even if the crime they had committed went directly against something I advocated. Everybody deserves a fair sentence, and if someone involved in the case thinks I have useful information that might help with that I'll give it.
He obviously didn't know his friend very well if he never noticed the drugs his friend had though in all of the time they spent together.
[1]: https://www.legalaffairsandtrials.com/p/ashton-kutcher-and-m...
[2]: https://substackcdn.com/image/fetch/w_1456,c_limit,f_webp,q_...