How can I measure the similarity between 2 IP addresses? Is there any code to re-use?
In Python there is the ipaddress module which can convert an IP address to an integer, then simply subtract to find the difference.

from ipaddress import ip_address
int(ip_address(‘10.0.0.1’))