<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def generate_handler():
 """Create the Blockade user and give them permissions."""

    logger.debug("[#] Setting up user, group and permissions")
    client = boto3.client("iam", region_name=PRIMARY_REGION)

    # Create the user
    try:
        response = client.create_user(
            UserName=BLOCKADE_USER
        )
    except client.exceptions.EntityAlreadyExistsException:
        logger.debug("[!] Blockade user already exists")
    logger.info("[#] %s user successfully created" % (BLOCKADE_USER))

    # Create the role
    try:
        logger.debug("[#] Creating %s role" % (BLOCKADE_ROLE))
        response = client.create_role(
            RoleName=BLOCKADE_ROLE,
            AssumeRolePolicyDocument=BLOCKADE_ROLE_POLICY,
            Description="Allow a user to manage the administration of Blockade."
        )
    except client.exceptions.EntityAlreadyExistsException:
        logger.debug("[!] Blockade role already exists")
    logger.info("[#] %s role successfully created" % (BLOCKADE_ROLE))

    # Create the group
    try:
        logger.debug("[#] Creating %s group" % (BLOCKADE_GROUP))
        response = client.create_group(
            GroupName=BLOCKADE_GROUP,
        )
    except client.exceptions.EntityAlreadyExistsException:
        logger.debug("[!] Blockade group already exists")
    logger.info("[#] %s group successfully created" % (BLOCKADE_GROUP))

    # Generate all policy items
    logger.debug("[#] Creating Blockade IAM policies")
    for label in BLOCKADE_POLICIES:
        logger.debug("[#] Creating %s policy" % (label))
        try:
            response = client.create_policy(
                PolicyName=label,
                PolicyDocument=POLICIES[label],
                Description="Generated policy from Blockade bootstrap tool"
            )
        except client.exceptions.EntityAlreadyExistsException:
            logger.debug("[!] Blockade policy %s already exists" % (label))
        logger.info("[#] Blockade %s policy successfully created" % (label))
    logger.info("[#] Blockade policies successfully created")

    # Attach policies to all entity types
    iam = boto3.resource('iam')
    account_id = iam.CurrentUser().arn.split(':')[4]
    for label in BLOCKADE_POLICIES + ['PushToCloud', 'APIGatewayAdmin']:
        logger.debug("[#] Attaching %s policy" % (label))
        arn = 'arn:aws:iam::{id}:policy/{policy}'.format(id=account_id, policy=label)
        if label == 'PushToCloud':
            arn = "arn:aws:iam::aws:policy/service-role/AmazonAPIGatewayPushToCloudWatchLogs"
        if label == 'APIGatewayAdmin':
            arn = "arn:aws:iam::aws:policy/AmazonAPIGatewayAdministrator"
        client.attach_role_policy(RoleName=BLOCKADE_ROLE, PolicyArn=arn)
        client.attach_group_policy(GroupName=BLOCKADE_GROUP, PolicyArn=arn)
    logger.info("[#] Blockade policies successfully attached")

    logger.debug("[#] Adding %s to %s group" % (BLOCKADE_USER, BLOCKADE_GROUP))
    response = client.add_user_to_group(
        GroupName=BLOCKADE_GROUP,
        UserName=BLOCKADE_USER
    )
    logger.info("[#] %s user is part of %s group" % (BLOCKADE_USER, BLOCKADE_GROUP))

    return True