'Sometimes a handle to a bucket is not established right away so try
it a few times. Raise error is connection is not established.'

def _get_bucket(self, bucket_name):

    for i in range(5):
        try:
            bucket = self.conn.get_bucket(bucket_name)
            log.debug("Using    cloud    object    store    with    bucket    '%s'", bucket.name)
            return bucket
        except S3ResponseError:
            try:
                log.debug("Bucket    not    found,    creating    s3    bucket    with    handle    '%s'", bucket_name)
                self.conn.create_bucket(bucket_name)
            except S3ResponseError:
                log.exception("Could    not    get    bucket    '%s',    attempt    %s/5", bucket_name, (i + 1))
                time.sleep(2)
    raise S3ResponseError
