Perform an operation until success

        Repeats in the face of connection errors, pursuant to retry policy.

def ensure(self, connection, func, *args, **kwargs):
        """Perform an operation until success

        Repeats in the face of connection errors, pursuant to retry policy.
        """
        channel = None
        while 1:
            try:
                if channel is None:
                    channel = connection.channel()
                return func(channel, *args, **kwargs), channel
            except (connection.connection_errors, IOError):
                self._call_errback()

            channel = self.connect(connection)