What’s the trick to writing a genuinely funny comedy? The trick is therapy. Take notes.