def __call__(self, *args, **kwargs):
        """ Automatic handling of AutoReconnect-exceptions.
        """
        start = time.time()
        i = 0
        while True:
            try:
                val = self.method(*args, **kwargs)

                # If we get back a cursor, we need to also make sure it tries
                # to auto-reconnect on failure.
                if isinstance(val, pymongo.cursor.Cursor):
                    return MongoProxy(val, self.logger, self.wait_time)
                else:
                    return val
            except pymongo.errors.AutoReconnect:
                end = time.time()
                delta = end - start
                if delta >= self.wait_time:
                    break
                self.logger.warning('AutoReconnecting, try %d (%.1f seconds)'
                                    % (i, delta))
                time.sleep(min(5, pow(2, i)))
                i += 1
        # Try one more time, but this time, if it fails, let the
        # exception bubble up to the caller.
        return self.method(*args, **kwargs)
dataset/ETHPy150Open girder/girder/girder/external/mongodb_proxy.py/Executable.__call__/original