Based off of subversion r69 from http://code.google.com/p/ipaddr-py/ This code is 2to3 safe, I'll merge it into py3k later this afternoon.