[0] https://docs.python.org/3/library/ipaddress.html
https://pypi.python.org/pypi/pysubnettree
Last time I played with it, it didn't like Python 3 or ipaddress, though. I see a recent upload, so maybe they addressed that.
just try: socket.inet_aton