You can check if a given number is a square of an integer using the code below:
def is_square(x):
s = int(sqrt(x) + 0.5)
return s * s == x
Similar approach can be used for a diophantine equation. Just convert y found for a given x to int (y = int(y + 0.5)) and then check if diophantine equation is true for found given x and y