def METHOD_NAME(
        make_stubber, make_unique_name, stub_runner,
        error_code, stop_on_method, keep_going):
    s3_stubber = make_stubber(versioning.s3.meta.client)
    bucket_name = make_unique_name('bucket')
    obj_prefix = 'test-prefix'
    with stub_runner(error_code, stop_on_method) as runner:
        runner.add(
            s3_stubber.stub_create_bucket, bucket_name,
            versioning.s3.meta.client.meta.region_name, keep_going=keep_going)
        runner.add(
            s3_stubber.stub_put_bucket_versioning, bucket_name, 'Enabled',
            keep_going=keep_going)
        runner.add(
            s3_stubber.stub_put_bucket_lifecycle_configuration, bucket_name, [{
                'Status': 'Enabled',
                'Prefix': obj_prefix,
                'NoncurrentVersionExpiration': {'NoncurrentDays': ANY}
            }], keep_going=keep_going)
    if error_code is None or keep_going:
        bucket = versioning.create_versioned_bucket(bucket_name, obj_prefix)
        assert bucket.name == bucket_name
    else:
        with pytest.raises(ClientError) as exc_info:
            versioning.create_versioned_bucket(bucket_name, obj_prefix)
        assert exc_info.value.response['Error']['Code'] == error_code