put traceroute call in its own function and replaced subprocess Popen with check_output