(requests)
return out
Return list of pairs (event_type, requests)
    that should be registered as one of aggregating event types: ows:all, other,
Return list of pairs (event_type, requests)
    that should be registered as one of aggregating event types: ows:all, other,
Return list of pairs ( event_type requests ) that should be registered as one of aggregating event types : ows : all other
def extract_special_event_types(requests):
    """
    Return list of pairs (event_type, requests)
    that should be registered as one of aggregating event types: ows:all, other,
    """
    out = []

    ows_et = requests.exclude(event_type__isnull=True)\
                     .filter(event_type__name__startswith='OWS:')\
                     .exclude(event_type__name=EventType.EVENT_OWS)\
                     .distinct('event_type')\
                     .values_list('event_type', flat=True)
    ows_rq = requests.filter(event_type__in=ows_et)
    ows_all = EventType.get(EventType.EVENT_OWS)
    out.append((ows_all, ows_rq,))

    nonows_et = requests.exclude(event_type__isnull=True)\
                        .exclude(event_type__name__startswith='OWS:')\
                        .exclude(event_type__name=EventType.EVENT_OTHER)\
                        .distinct('event_type')\
                        .values_list('event_type', flat=True)
    nonows_rq = requests.filter(event_type__in=nonows_et)
    nonows_all = EventType.get(EventType.EVENT_OTHER)
    out.append((nonows_all, nonows_rq,))

    return out
def extract_special_event_types ( requests ) : out = [ ] ows_et = requests . exclude ( event_type__isnull = True ) . filter ( event_type__name__startswith = 'OWS:' ) . exclude ( event_type__name = EventType . EVENT_OWS ) . distinct ( 'event_type' ) . values_list ( 'event_type' , flat = True ) ows_rq = requests . filter ( event_type__in = ows_et ) ows_all = EventType . get ( EventType . EVENT_OWS ) out . append ( ( ows_all , ows_rq , ) ) nonows_et = requests . exclude ( event_type__isnull = True ) . exclude ( event_type__name__startswith = 'OWS:' ) . exclude ( event_type__name = EventType . EVENT_OTHER ) . distinct ( 'event_type' ) . values_list ( 'event_type' , flat = True ) nonows_rq = requests . filter ( event_type__in = nonows_et ) nonows_all = EventType . get ( EventType . EVENT_OTHER ) out . append ( ( nonows_all , nonows_rq , ) ) return out