+ # longs could be v4 addresses, but we will only assume so if the
+ # value is small.
+ if isinstance(address, long):
+ if address <= pow(2, 32):
+ return CidrV4(address, netlen)
+ return CidrV6(address, netlen)
+ # otherwise, a colon in the address is a dead giveaway.
+ if ":" in address:
+ return CidrV6(address, netlen)
+ return CidrV4(address, netlen)
+
+class Cidr:
+ """A class representing a generic CIDRized network value."""
+