<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def rm(ctx, cluster_id):
 """Terminate a EMR cluster"""

    session = create_session(ctx.obj['AWS_PROFILE_NAME'])

    client = session.client('emr')
    try:
        result = client.describe_cluster(ClusterId=cluster_id)
        target_dns = result['Cluster']['MasterPublicDnsName']
        flag = click.prompt(
            "Are you sure you want to terminate {0}: {1}? [y/Y]".format(
                cluster_id, target_dns), type=str, default='n')
        if flag.lower() == 'y':
            result = client.terminate_job_flows(JobFlowIds=[cluster_id])
    except ClientError as e:
        click.echo(e, err=True)