def METHOD_NAME(
    request: ActionRulesRequest,
) -> ActionRulesResponse:
    """
    Create an action rule.
    """
    logger.info("request: %s", request)
    error_message = ""
    try:
        hmaconfig.create_config(request.action_rule)
    except ClientError as e:
        # TODO this test for "already exists" should be moved to a common place
        if e.response["Error"]["Code"] == "ConditionalCheckFailedException":
            error_message = f"An action rule with the name '{request.action_rule.name}' already exists."
            logger.warning(
                "Duplicate action rule creation attempted: %s",
                e.response["Error"]["Message"],
            )
        else:
            error_message = "Unexpected error."
            logger.error(
                "Unexpected client error: %s", e.response["Error"]["Message"]
            )
            logger.exception(e)
        response.status = 500
    except Exception as e:
        error_message = "Unexpected error."
        handle_unexpected_error(e)
    return ActionRulesResponse(error_message)