Taken from here:

$ python -m py_compile script.py