Note that this is based on wrapt's ObjectProxy with one big change: it calls a function the first time the proxy object is used, while wrapt.ObjectProxy just forwards the method calls to the target ...