CLN/ENH: use Scope.swapkey() to update names

Also useful for replacing local variable names with their mangled versions.
CLN: update expr.py for scope changes and remove unused isexpr
ENH/CLN: track scope instead of hard coding minimal stack level
BUG: Hold temporaries created by parsing in a separate dict
TST/CLN: Add tests for new local variable API
ENH: update pytables for new scoping
ERR/API: disallow local references in top-level calls to eval
BUG: ChainMap m parameter only exists in Python 3.4

So backport that as well.
BUG: use a regular for loop in _ensure_term

In Python 3.x list comprehension build up stack frames, thus providing the
stack level to search is not the same as it is in Python 2.x.