Changed ping from subprocess to pure python implementation