Given either the binary or string representation of an IPv6 address and its prefix length, what's the best way to extract the prefix in Python?
Is there a library that would do this for me, or would I have to:
- convert the address from string to an int (inet_ntop)
- Mask out the prefix
- Convert prefix back to binary
- Convert binary to string (inet_ntop)