Added in #664 to remove duplicate code. This is moved from PythonRunner.scala.