Add run_spec function for Python 3 compatibility