def _ensure_bucket_exists(s3, bucket, region):  # pragma: no cover
    try:
        s3.head_bucket(Bucket=bucket)
    except botocore.exceptions.ClientError:
        if region != 'us-east-1':
            s3.create_bucket(Bucket=bucket, CreateBucketConfiguration={
                'LocationConstraint': region})
        else:
            s3.create_bucket(Bucket=bucket)