def _is_stream_tty(stream):
    try:
        return stream.isatty()
    except ValueError as exc:
        if ('I/O' in str(exc)):
            return False
        raise
def _is_stream_tty(stream):
    try:
        return stream.isatty()
    except ValueError as exc:
        if ('I/O' in str(exc)):
            return False
        raise