call the method parser.compile_filter with an argument string "var|%s", where '%s' is replaced with rest, substitute the result for filter_expr.
filter_expr = parser . compile_filter ( "var|%s" % ( rest ) )