subprocess.check_output() was introduced in python 2.7, replaced it with something that works in python 2.6