import json


def _record_message(record):
    """Return the message part of the given SNS record."""

    source = record["EventSource"]

    if source == "aws:sns":
        return json.loads(record["Sns"]["Message"])

    raise ValueError(f"Unsuported 'EventSource' {source}. Supported types: 'aws:sns'")