Refactor traceroute.py