title: using inet_ntoa function in Python
body: <p>I've recently started to program in python and I'm having some trouble understanding how <code>inet_nota</code> and <code>inet_aton</code> work in Python. Coming from php/mysql I've always stored ip addresses in the database as long variables. Also the <code>inet_ntoa</code> method in mysql receives a long variable as parameter and returns the dotted format of an IP, so I assumed the Python version works in a similar manner. However, it seems Python's <code>inet_ntoa</code> needs a 32-bit packed binary format. So, having the IP address stored as <code>167772160</code> value, how can I convert it to a 32-bit packed binary value (like <code>\x7f\x00\x00\x01</code>) which is needed by <code>inet_ntoa</code> method? </p>
  
  <p>Thanks a lot</p>