def _GetMainModule():
 deepest_frame = sys._getframe(0)
 while (deepest_frame.f_back is not None):
  deepest_frame = deepest_frame.f_back
 globals_for_main_module = deepest_frame.f_globals
 main_module_name = _GetModuleObjectAndName(globals_for_main_module)[1]
 if (main_module_name is None):
  main_module_name = sys.argv[0]
 return main_module_name

def _GetMainModule ( ) : deepest_frame = sys . _getframe ( 0 ) while ( deepest_frame . f_back is not None ) : deepest_frame = deepest_frame . f_back globals_for_main_module = deepest_frame . f_globals main_module_name = _GetModuleObjectAndName ( globals_for_main_module ) [ 1 ] if ( main_module_name is None ) : main_module_name = sys . argv [ 0 ] return main_module_name
returns: string .