How would you rewrite this Python code?
Every way I can think of is either too messy, too verbose, or overkill.  Can you think of a better way?
Tags: python, codereview, refactoring, discuss