def detect_clause(parser, clause_name, tokens):
    if clause_name in tokens:
        t_index = tokens.index(clause_name)
        clause_value = parser.compile_filter(tokens[t_index + 1])
        del tokens[t_index:t_index + 2]
    else:
        clause_value = None
    return clause_value
Helper function detects a certain clause in tag tokens list.
dataset/ETHPy150Open idlesign/django-sitetree/sitetree/templatetags/sitetree.py/detect_clause