def METHOD_NAME(dataset: Dataset, aggregate: str) -> EntityKey:
    if dataset == Dataset.Events:
        entity_key = EntityKey.Events
    elif dataset == Dataset.Transactions:
        entity_key = EntityKey.Transactions
    elif dataset in [Dataset.Metrics, Dataset.Sessions]:
        match = re.match(CRASH_RATE_ALERT_AGGREGATE_RE, aggregate)
        if not match:
            raise Exception(
                f"Only crash free percentage queries are supported for subscriptions"
                f"over the {dataset.value} dataset"
            )
        if dataset == Dataset.Metrics:
            count_col_matched = match.group(2)
            if count_col_matched == "sessions":
                entity_key = EntityKey.MetricsCounters
            else:
                entity_key = EntityKey.MetricsSets
        else:
            entity_key = EntityKey.Sessions
    else:
        raise Exception(f"{dataset} dataset does not have an entity key mapped to it")
    return entity_key