def _get_stdout(stderr=False):
 if stderr:
  stream = u'stderr'
 else:
  stream = u'stdout'
 sys_stream = getattr(sys, stream)
 if (IPythonIOStream is None):
  return sys_stream
 ipyio_stream = getattr(ipyio, stream)
 if (isatty(sys_stream) and isatty(ipyio_stream)):
  return ipyio_stream
 else:
  return sys_stream

def _get_stdout ( stderr = False ) : if stderr : stream = u'stderr' else : stream = u'stdout' sys_stream = getattr ( sys , stream ) if ( IPythonIOStream is None ) : return sys_stream ipyio_stream = getattr ( ipyio , stream ) if ( isatty ( sys_stream ) and isatty ( ipyio_stream ) ) : return ipyio_stream else : return sys_stream
this utility function contains the logic to determine what streams to use by default for standard out/err .