code: def test_silent_mode_is_respected_in_multithreaded_environments(
      autolog_function, patch_destination, logger
  ):
      og_showwarning = warnings.showwarning
      stream = StringIO()
      sys.stderr = stream
  
      autolog_function(silent=True)
  
      def parallel_fn():
          # Sleep for a random interval to increase the likelihood of overlapping session stages
          # (i.e. simultaneous preamble / postamble / original function execution states across
          # autologging sessions)
          time.sleep(np.random.random())
          patch_destination.fn()
          return True
  
      executions = []
      with pytest.warns(None) as warnings_record:
          with ThreadPoolExecutor(max_workers=50) as executor:
              for _ in range(100):
                  executions.append(executor.submit(parallel_fn))
  
      assert all(e.result() is True for e in executions)
  
      # Verify that all warnings and log events from MLflow autologging code were silenced
      # and that all warnings from the original / underlying routine were emitted as normal
      assert not stream.getvalue()
      assert len(warnings_record) == 100
      assert all(
          "Test warning from OG function" in str(w.message)
          for w in warnings_record
      )
  
      # Verify that `warnings.showwarning` was restored to its original value after training
      # and that MLflow event logs are enabled
      assert warnings.showwarning == og_showwarning
      logger.info("verify that event logs are enabled")
      assert "verify that event logs are enabled" in stream.getvalue()
  
imports: import logging
  import sys
  import time
  import warnings
  from concurrent.futures import ThreadPoolExecutor
  from io import StringIO
  import numpy
  import pytest
  import mlflow
  from mlflow.utils.autologging_utils import autologging_integration, safe_patch
  from mlflow.utils.logging_utils import eprint
  from tests.autologging.fixtures import patch_destination, reset_stderr, test_mode_off
label_desc: Use image node_id 5 for calling a global function with example usage: test_silent_mode_is_respected_in_multithreaded_environments(autolog_function, patch_destination, logger) and returns: True