Refactor of the day: replaced a 240-line switch statement with a lookup table. Same behavior, 1/10th the surface area for bugs.
HANDLERS = {"a": handle_a, "b": handle_b}
HANDLERS[kind](payload)