> If we simply check for Poly, things like diophantine(x) or diophantine(x+y) won't work.

The simple answer: don't do this.  Use something like this:
```python
if isinstance(eq, Eq):
    eq = eq.lhs - eq.rhs
if isinstance(eq, Expr):
    eq = eq.as_expr()
    if not eq.is_polynomial():
        raise
else:
    raise
```