Attempt to compile it. If the script uses syntax specific to a version then the compilation will fail.
$ python2 -m py_compile foo.py
$ python3 -m py_compile foo.py
Attempt to compile it. If the script uses syntax specific to a version then the compilation will fail.
$ python2 -m py_compile foo.py
$ python3 -m py_compile foo.py