Python function spy support for unit tests