code: def enable_global_typechecked_profiler(flag = True):
      
      global global_typechecked_profiler, _global_type_agent, global_typelogged_profiler
      global_typechecked_profiler = flag
      if flag and checking_enabled:
          if _global_type_agent is None:
              _global_type_agent = TypeAgent()
              _global_type_agent.start()
          elif not _global_type_agent.active:
              _global_type_agent.start()
      elif not flag and not global_typelogged_profiler and \
              not _global_type_agent is None and _global_type_agent.active:
          _global_type_agent.stop()
docs: Enables or disables global typechecking mode via a profiler.
      See flag global_typechecked_profiler.
      Does not work if checking_enabled is false.