I use the pcapy/impacket library to decode network packets in Python. It has an IP decoder which knows about the syntax of IPv4 packets but apparently no IPv6 decoder.
Does anyone get one?
In a private correspondance, the Impacket maintainers say it may be better to start with Scapy
You can use a really useful one-file library from google from
http://code.google.com/p/ipaddr-py/
that supports IPv4, IPv6, ip validation, netmask and prefix managements, etc. It's well coded and documented.
Good luck
Emilio