def DWDistrictFilter(queryset, querydict):
    try:
        district_list=querydict['districts']
        
        # if there's no commas, it's just a single district
        if district_list.find(',') < 0:
            queryset = queryset.filter(district__pk=district_list)
            
        # if there's a comma, it's a comma-delimited list
        else:
            district_ids = district_list.split(',')
            queryset = queryset.filter(district__pk__in=district_ids)
    
    except __HOLE__:
        pass
        
    return queryset
dataset/ETHPy150Open sunlightlabs/read_FEC/fecreader/api/filters.py/DWDistrictFilter