def METHOD_NAME(message: str):
    data = json.loads(message)
    t = data.pop("type")
    if t not in PS_DESER_MAP:
        raise TypeError(f"{t} is not a valid pubsub message type.")
    return PS_DESER_MAP[t].from_dict(data)