Backport of Python 3's ipaddress module