@register.filter(name='limit')    
def limit(value, arg):
    """
    Returns a slice of the list.

    Uses the same syntax as Python's list slicing; see
    http://diveintopython.org/native_data_types/lists.html#odbchelper.list.slice
    for an introduction.
    """
    try:
        bits = []
        for x in arg.split(u':'):
            if len(x) == 0:
                bits.append(None)
            else:
                bits.append(int(x))
        return value[slice(*bits)]

    except (ValueError, __HOLE__):
        return value # Fail silently.
dataset/ETHPy150Open darcyliu/storyboard/home/templatetags/filter.py/limit