def METHOD_NAME(self, mock_stdout=True, mock_stderr=True):
    """Context manager to mock stdout and stderr"""
    if mock_stdout:
        self.mock_stdout(True)
    if mock_stderr:
        self.mock_stderr(True)
    try:
        if mock_stdout and mock_stderr:
            yield sys.stdout, sys.stderr
        elif mock_stdout:
            yield sys.stdout
        else:
            yield sys.stderr
    finally:
        if mock_stdout:
            self.mock_stdout(False)
        if mock_stderr:
            self.mock_stderr(False)