import json


def create_iam_role(config, iam):
    """Creates an AWS IAM Role for Redshift

    Args:
        config: a ConfigParser object
        iam: a boto3 client object for the AWS IAM service

    Returns:
        A dict of the created IAM role's attributes
    """
    print("Creating IAM Role: ", config['IAM_ROLE']['NAME'])
    return iam.create_role(
        Path='/',
        RoleName=config['IAM_ROLE']['NAME'],
        AssumeRolePolicyDocument=json.dumps(
            config['IAM_ROLE']['TRUST_POLICY']
        ),
        Description='Role for Accessing Redshift data warehouse'
    )