import json


def parse_sns_event(event):
    """Parse SNS event"""
    message = json.loads(event["Records"][0]["Sns"]["Message"])
    alarm_state = message["NewStateValue"]
    instance_id = None
    for dim in message["Trigger"]["Dimensions"]:
        if dim["name"] == "InstanceId":
            instance_id = dim["value"]
            break
    if instance_id is None:
        raise AttributeError("ERROR: Could not find Instance ID")
    return instance_id, alarm_state