code: def catch_stdout():
      """
      Context manager that catches output in terminal and returns
      StringIO instance.
  
      Yields
      ------
      StringIO instance
  
      Examples
      --------
      >>> with catch_stdout() as out:
      ...     print("Unittest")
      ...     terminal_output = out.getvalue()
      ...     self.assertIn("test", terminal_output)
      """
      old_out = sys.stdout
      old_err = sys.stderr
  
      out = six.StringIO()
  
      sys.stdout = out
      sys.stderr = out
  
      yield out
  
      sys.stdout = old_out
      sys.stderr = old_err
  
file_path: neupy/tests/helpers.py
imports: import sys
  from contextlib import contextmanager
  import six
  import numpy
  import pandas
  from sklearn import datasets
  from sklearn.model_selection import StratifiedShuffleSplit
  from matplotlib import pyplot
  from neupy import algorithms, layers, utils, init
  from neupy.storage import save_dict, load_dict
label_desc: Use image node_id 2 for calling a global function with example usage: catch_stdout() without return types