'Flush output and process input while waiting for any of the given
callbacks to return true. The wait is aborted upon channel-close or
connection-close.
Otherwise, processing continues until the output is flushed AND at least
one of the callbacks returns true. If there are no callbacks, then
processing ends when all output is flushed.
:param waiters: sequence of zero or more callables taking no args and
returning true when it\'s time to stop processing.
Their results are OR\'ed together.'

def _flush_output(self, *waiters):

    if self.is_closed:
        raise exceptions.ChannelClosed()
    if (not waiters):
        waiters = self._ALWAYS_READY_WAITERS
    self._connection._flush_output(self._channel_closed_by_broker_result.is_ready, *waiters)
    if self._channel_closed_by_broker_result:
        self._cleanup()
        method = self._channel_closed_by_broker_result.value.method_frame.method
        raise exceptions.ChannelClosed(method.reply_code, method.reply_text)
