Format the year value of the ``YearArchiveView``,
    which can be a integer or date object.

    This tag is no longer needed, but exists for template compatibility.
    It was a compatibility tag for Django 1.4.

def format_year(year):
    """
    Format the year value of the ``YearArchiveView``,
    which can be a integer or date object.

    This tag is no longer needed, but exists for template compatibility.
    It was a compatibility tag for Django 1.4.
    """
    if isinstance(year, (date, datetime)):
        # Django 1.5 and up, 'year' is a date object, consistent with month+day views.
        return unicode(year.year)
    else:
        # Django 1.4 just passes the kwarg as string.
        return unicode(year)