def yearFilter(queryset, querydict):
    try:
        year=int(querydict['year_covered'])
        queryset = queryset.filter(Q(coverage_from_date__gte=date(year,1,1), coverage_to_date__lte=date(year,12,31)))
    
    except (__HOLE__, ValueError):
        pass
    return queryset
dataset/ETHPy150Open sunlightlabs/read_FEC/fecreader/api/filters.py/yearFilter