Change check_output to Popen for 2.6 compatibility