def _GetCallingModuleObjectAndName():
 for depth in range(1, sys.getrecursionlimit()):
  if (not (sys._getframe(depth).f_globals is globals())):
   globals_for_frame = sys._getframe(depth).f_globals
   (module, module_name) = _GetModuleObjectAndName(globals_for_frame)
   if (module_name is not None):
    return (module, module_name)
 raise AssertionError('No module was found')

def _GetCallingModuleObjectAndName ( ) : for depth in range ( 1 , sys . getrecursionlimit ( ) ) : if ( not ( sys . _getframe ( depth ) . f_globals is globals ( ) ) ) : globals_for_frame = sys . _getframe ( depth ) . f_globals ( module , module_name ) = _GetModuleObjectAndName ( globals_for_frame ) if ( module_name is not None ) : return ( module , module_name ) raise AssertionError ( 'No module was found' )
returns the module thats calling into this module .