def METHOD_NAME(group_type, organization):
    """
    We want to know which person is in which parliamentary group. Instead of iterating over the persons directly,
    we're gonna go over memberships, which can carry a start and a end date with them. We then prefetch
    all membership -> person -> their memberships -> parliamentary groups (= organizations with the right type)
    Django does some really awesome stuff then and transforms this into 4 fast queries
    """
    queryset = Membership.objects.filter(
        organization__organization_type_id=group_type
    ).prefetch_related("organization")
    prefetch = Prefetch(
        "person__membership_set", queryset=queryset, to_attr="prefetched_orgs"
    )
    memberships = organization.membership_set.filter(
        Q(end__isnull=True) | Q(end__gt=timezone.now())
    ).prefetch_related(prefetch)
    return memberships