I went with the latter. To summarize the game plan, we'll hook the place wherethe Function is constructed, get a reference to that Function object, hook theplace where it's called, and if it's the same reference we got before, call aFunction object of our own creation instead. Here's what my patch looks like: