strict struct.pack for 2.6
diff --git a/ipaddress.py b/ipaddress.py
index e818924..1f52f23 100644
--- a/ipaddress.py
+++ b/ipaddress.py
@@ -43,8 +43,12 @@
     assert isinstance(intval, _compat_int_types)
     assert endianess == 'big'
     if length == 4:
+        if intval < 0 or intval >= 2**32:
+            raise struct.error("integer out of range for 'I' format code")
         return struct.pack('!I', intval)
     elif length == 16:
+        if intval < 0 or intval >= 2**128:
+            raise struct.error("integer out of range for 'QQ' format code")
         return struct.pack('!QQ', intval >> 64, intval & 0xffffffffffffffff)
     else:
         raise NotImplementedError()