title: Python find first network hop
body: <p>I need to find the first network hop is in a python program on Linux.  I can't just depend on the default gateway being the first hop, because some of the network software on the box may (or may not) insert catch all routes:</p>
  
  <p><code>0.0.0.0/1</code><br>
  <code>128.0.0.0/1</code></p>
  
  <p>I've thought about popen'ing a <code>tracepath -m 1 &lt;some ip&gt;</code> and parsing the output, but I dislike depending on the format of the output of another program.  Reading the routing table from /proc and applying routing logic to it I think is a little beyond my scripting abilities, though I will likely try it at some point.  Is there a an easier way (has someone else already invented-this-wheel in a module I'm not aware of)?</p>