Revert back to isinstance in matches and override __instancecheck__ for
UndefinedFunction.  Has the advantage of not breaking any code relying
on isinstance retaining the same behavior with a bounded/unbounded cache.