Fix inconsistent behavior when matching functions by using '==' rather than 'is' comparison.
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.
ensure isintance correctly handles subclasses
Added tests for fix.  One currently fails in master.  The other fails if
proper care is not taken in overriding __instancecheck__
Merge pull request #7688 from pbrady/matches_fix

Fix inconsistent caching/matching behavior