I was about to say that isinstance would choke on the nested tuple, but it looks like it can handle it. Neat!