fix test after changing dict.keys() in Py3
fix dir() implementation to always return a sorted list
make SortedDictKeysNode look more like other pass-through nodes
avoid list building when in-testing against dir() result
let type analysis know that globals() and locals() can never return None