def _with_retries(self, pool, fn):
        skip_nodes = []

        def _skip_bad_nodes(transport):
            return transport._node not in skip_nodes

        retry_count = self.retries

        for retry in range(retry_count):
            try:
                with pool.transaction(_filter=_skip_bad_nodes) as transport:
                    try:
                        return fn(transport)
                    except (IOError, HTTPException) as e:
                        if _is_retryable(e):
                            transport._node.error_rate.incr(1)
                            skip_nodes.append(transport._node)
                            raise BadResource(e)
                        else:
                            raise
            except BadResource as e:
                if retry < (retry_count - 1):
                    continue
                else:
                    # Re-raise the inner exception
                    raise e.args[0]
Contrastive loss from Hadsell-et-al.'06
dataset/ETHPy150Open basho/riak-python-client/riak/client/transport.py/RiakClientTransport._with_retries--crossover with--dataset/ETHPy150Open fchollet/keras/examples/mnist_siamese_graph.py/contrastive_loss