parameters: (func, funcname)
return_statement: return name
docstring: Figure out the module in which a function occurs.
  
      Search sys.modules for the module.
      Cache in classmap.
      Return a module name.
      If the function cannot be found, return "__main__".
docstring_summary: Figure out the module in which a function occurs.
docstring_tokens: Figure out the module in which a function occurs .
function: def whichmodule(func, funcname):
      """Figure out the module in which a function occurs.
  
      Search sys.modules for the module.
      Cache in classmap.
      Return a module name.
      If the function cannot be found, return "__main__".
      """
      # Python functions should always get an __module__ from their globals.
      mod = getattr(func, "__module__", None)
      if mod is not None:
          return mod
      if func in classmap:
          return classmap[func]
  
      for name, module in sys.modules.items():
          if module is None:
              continue # skip dummy package entries
          if name != '__main__' and getattr(module, funcname, None) is func:
              break
      else:
          name = '__main__'
      classmap[func] = name
      return name
function_tokens: def whichmodule ( func , funcname ) : # Python functions should always get an __module__ from their globals. mod = getattr ( func , "__module__" , None ) if mod is not None : return mod if func in classmap : return classmap [ func ] for name , module in sys . modules . items ( ) : if module is None : continue # skip dummy package entries if name != '__main__' and getattr ( module , funcname , None ) is func : break else : name = '__main__' classmap [ func ] = name return name