def _GetModuleObjectAndName(globals_dict):
 for (name, module) in sys.modules.items():
  if (getattr(module, '__dict__', None) is globals_dict):
   if (name == '__main__'):
    name = sys.argv[0]
   return (module, name)
 return (None, None)

def _GetModuleObjectAndName ( globals_dict ) : for ( name , module ) in sys . modules . items ( ) : if ( getattr ( module , '__dict__' , None ) is globals_dict ) : if ( name == '__main__' ) : name = sys . argv [ 0 ] return ( module , name ) return ( None , None )
returns the module that defines a global environment .