code: def _run_doctests(tests, full_name, verbose, doctest_warnings):
      """Run modified doctests for the set of `tests`.
  
      Returns: list of [(success_flag, output), ...]
      """
      flags = NORMALIZE_WHITESPACE | ELLIPSIS | IGNORE_EXCEPTION_DETAIL
      runner = DTRunner(
          full_name,
          checker=Checker(),
          optionflags=flags,
          verbose=verbose,
      )
  
      output = io.StringIO(newline="")
      success = True
      # Redirect stderr to the stdout or output
      tmp_stderr = sys.stdout if doctest_warnings else output
      from scipy._lib._util import _fixed_default_rng
  
      @contextmanager
      def temp_cwd():
          cwd = os.getcwd()
          tmpdir = tempfile.mkdtemp()
          try:
              os.chdir(tmpdir)
              yield tmpdir
          finally:
              os.chdir(cwd)
              shutil.rmtree(tmpdir)
  
      # Run tests, trying to restore global state afterward
      cwd = os.getcwd()
      with np.errstate(), np.printoptions(), temp_cwd(), redirect_stderr(
          tmp_stderr
      ), _fixed_default_rng():
          # try to ensure random seed is NOT reproducible
          np.random.seed(None)
  
          for t in tests:
              t.filename = short_path(t.filename, cwd)
              fails, successes = runner.run(t, out=output.write)
              if fails > 0:
                  success = False
  
      output.seek(0)
      return success, output.read()
  
imports: import copy
  import doctest
  import glob
  import inspect
  import io
  import os
  import re
  import shutil
  import sys
  import tempfile
  import warnings
  from argparse import ArgumentParser
  from contextlib import contextmanager, redirect_stderr
  from doctest import NORMALIZE_WHITESPACE, ELLIPSIS, IGNORE_EXCEPTION_DETAIL
  import docutils.core
  import numpy
  from docutils.parsers.rst import directives
  from numpydoc.docscrape_sphinx import get_doc_object
  from numpydoc.docscrape import NumpyDocString
  from scipy.stats._distr_params import distcont, distdiscrete
  from scipy import stats
  from sphinx.directives.other import SeeAlso, Only
label_desc: Use image node_id 11 for calling a global function with example usage: _run_doctests(tests, full_name, verbose, doctest_warnings) and returns: success,  output