@property
    def s3_bucket(self):
        if not hasattr(self, 'cached_bucket'):
            self.check_prerequisites()
            with PatchedBotoConfig():
                from boto.exception import BotoClientError, BotoServerError, S3ResponseError
                # The following try/except block translates unexpected exceptions
                # raised by Boto into a CacheBackendError exception.
                try:
                    # The following try/except block handles the expected exception
                    # raised by Boto when an Amazon S3 bucket does not exist.
                    try:
                        logger.debug("Connecting to Amazon S3 bucket: %s", self.config.s3_cache_bucket)
                        self.cached_bucket = self.s3_connection.get_bucket(self.config.s3_cache_bucket)
                    except S3ResponseError as e:
                        if e.status == 404 and self.config.s3_cache_create_bucket:
                            logger.info("Amazon S3 bucket doesn't exist yet, creating it now: %s",
                                        self.config.s3_cache_bucket)
                            self.s3_connection.create_bucket(self.config.s3_cache_bucket)
                            self.cached_bucket = self.s3_connection.get_bucket(self.config.s3_cache_bucket)
                        else:
                            # Don't swallow exceptions we can't handle.
                            raise
                except (BotoClientError, BotoServerError):
                    raise CacheBackendError("""
                        Failed to connect to the configured Amazon S3 bucket
                        {bucket}! Are you sure the bucket exists and is accessible
                        using the provided credentials? The Amazon S3 cache backend
                        will be disabled for now.
                    """, bucket=repr(self.config.s3_cache_bucket))
        return self.cached_bucket
Connect to the user defined Amazon S3 bucket.
dataset/ETHPy150Open paylogic/pip-accel/pip_accel/caches/s3.py/S3CacheBackend.s3_bucket