def METHOD_NAME(bucket, cloudformation_outputs, emr_security_configuration):
    cluster_id = wr.emr.create_cluster(
        subnet_id=cloudformation_outputs["PublicSubnet1"],
        docker=True,
        custom_classifications=[
            {
                "Classification": "livy-conf",
                "Properties": {
                    "livy.spark.master": "yarn",
                    "livy.spark.deploy-mode": "cluster",
                    "livy.server.session.timeout": "16h",
                },
            }
        ],
        steps=[wr.emr.build_step("spark-submit --deploy-mode cluster s3://bucket/emr.py")],
        security_configuration=emr_security_configuration,
    )
    wr.emr.submit_ecr_credentials_refresh(cluster_id, path=f"s3://{bucket}/emr/")
    wr.emr.submit_steps(
        cluster_id=cluster_id,
        steps=[
            wr.emr.build_spark_step(
                path=f"s3://{bucket}/emr/test_docker.py",
                docker_image="123456789123.dkr.ecr.us-east-1.amazonaws.com/docker-emr:docker-emr",
            )
        ],
    )
    wr.emr.submit_spark_step(cluster_id=cluster_id, path=f"s3://{bucket}/emr/test_docker.py")
    emr_terminate_cluster_and_wait(cluster_id=cluster_id)