Change check_output to Popen as check_output only avaliable in 2.7