Here, use `is` rather than `==` when testing these. Also, to safeguard against non-Expr input (e.g. is_literal(1)), you could write as the second clause

```
elif not isinstance(expr, Expr):
    return False
```