Added some python2-3 compatibility stuff for subprocess.