Add check_output function to fix support for python2.6