i think this book was the first of the cookbook series. "¥ In lieu of author royalties for the recipes, a portion of the proceeds from the book sales would be donated to the Python Software Foundation. " sort dictionary.... items = adict.items( ) items.sort( ) return [value for key, value in items] print deepindex([[1,2],[3,[4,[5,6]]],7,[8,9]], 6) print deepindex([[1,2],[3,[4,[5,6]]],7,[8,9]], 66) unicode printing: import codecs, sys sys.stdout = codecs.lookup('iso8859-1')[-1](sys.stdout)