@register.filter(is_safe=True)
def last(value):
    """Return the last item in a list."""
    try:
        return value[-1]