def METHOD_NAME(expr: qlast.Expr) -> qlast.Query:
    # a sanity check added after refactoring AST
    assert isinstance(expr, qlast.Expr)
    if not isinstance(expr, qlast.Query):
        expr = qlast.SelectQuery(
            result=expr,
            implicit=True,
        )
    return expr