def METHOD_NAME(stream, *, stream_name):
    """Check if `stream` is an open io.IOBase instance."""
    if not isinstance(stream, io.IOBase):
        raise DaemonError(
            'Invalid {} stream object, an instance of io.IOBase is expected'.
            format(stream_name))
    if stream.closed:
        raise DaemonError('Stream {} is already closed'.format(stream_name))