whichmodule(func, funcname)
Return a likely candidate for the module that defines obj, where context is the name of the module in which obj was found.
Use a trick suggested by Guido to make sure we found the right module: Compare the function's globals with the module's globals. You've found the right module only when they match.