Python 3 list.keys() and list.sort() support (backward-compatible)