Version 2.0 of macros.py.  Many changes to simplify code and bring it up to modern coding standards.  The test in the docstring now passes.

It's not clear what the original intention of findParameters was.  The present code redoes the search for every expansion.  Alternatively, g.findNodeAnywhere could be used.