def METHOD_NAME(regex, expr):
    """
    Build an `filter(<regex>, <expr>)` type query expression.
    `regex` is a regex matched on the rule names from `expr`
    `expr` is a query expression of any supported type.
    """
    return "filter('{}', {})".format(regex, expr)