code: def main(
      stdout=None,
      stderr=None,
      argv=None,
      theano_nose=None,
      batch_size=None,
      time_profile=False,
      display_batch_output=False,
  ):
      """
      Run tests with optional output redirection.
  
      Parameters stdout and stderr should be file-like objects used to redirect
      the output. None uses default sys.stdout and sys.stderr.
  
      If argv is None, then we use arguments from sys.argv, otherwise we use the
      provided arguments instead.
  
      If theano_nose is None, then we use the theano-nose script found in
      Theano/bin to call nosetests. Otherwise we call the provided script.
  
      If batch_size is None, we use a default value of 100.
  
      If display_batch_output is False, then the output of nosetests during batch
      execution is hidden.
      """
  
      if stdout is None:
          stdout = sys.stdout
      if stderr is None:
          stderr = sys.stderr
      if argv is None:
          argv = sys.argv
      if theano_nose is None:
          # If Theano is installed with pip/easy_install, it can be in the
          # */lib/python2.7/site-packages/theano, but theano-nose in */bin
          for i in range(1, 5):
              path = theano.__path__[0]
              for _ in range(i):
                  path = os.path.join(path, "..")
              path = os.path.join(path, "bin", "theano-nose")
              if os.path.exists(path):
                  theano_nose = path
                  break
      if theano_nose is None:
          raise Exception("Unable to find theano-nose")
      if batch_size is None:
          batch_size = 100
      stdout_backup = sys.stdout
      stderr_backup = sys.stderr
      try:
          sys.stdout = stdout
          sys.stderr = stderr
          run(
              stdout,
              stderr,
              argv,
              theano_nose,
              batch_size,
              time_profile,
              display_batch_output,
          )
      finally:
          sys.stdout = stdout_backup
          sys.stderr = stderr_backup
  
file_path: Theano/theano/tests/run_tests_in_batch.py
imports: from __future__ import absolute_import, print_function, division
  import datetime
  import os
  import subprocess
  import sys
  import time
  from six.moves import xrange
  import six.moves.cPickle
  import theano
  from theano.misc.windows import output_subprocess_Popen
label_desc: Use image node_id 1 for calling a global function with example usage: main(stdout, stderr, argv, theano_nose, batch_size, time_profile, display_batch_output) without return types