def _trending_for_year(metric=None):
    this_year_date = year_for_date(datetime.date.today())
    previous_year_date = get_previous_year(this_year_date)

    data = {
            'year': 0,
            'previous_year': 0,
    }

    try:
        year = MetricYear.objects.get(metric=metric, created=this_year_date)
        data['year'] = year.num
    except __HOLE__:
        pass

    try:
        previous_year = MetricYear.objects.get(metric=metric, created=previous_year_date)
        data['previous_year'] = previous_year.num
    except ObjectDoesNotExist:
        pass

    return data
dataset/ETHPy150Open frankwiles/django-app-metrics/app_metrics/trending.py/_trending_for_year