def subscriber_by_payload(Subscriber, payload):
    """
    Map a subscriber to a subscription based on the given webhook payload.
    You can overwrite this function via settings.DJPADDLE_SUBSCRIBER_BY_PAYLOAD.

    must throw Subscriber.DoesNotExist in case the mapping failed.
    """
    if "email" not in payload:
        raise Subscriber.DoesNotExist("'email' missing in payload")
    return Subscriber.objects.get(email=payload["email"])