Can you avoid using ast here? I think you should be fine just returning a string like "2,7" and then doing

~~~
if (2, 6) <= version.split(',') <= (2, 7):
~~~