'Compare two IP objects.
This is only concerned about the comparison of the integer
representation of the network addresses.  This means that the
host bits aren\'t considered at all in this method.  If you want
to compare host bits, you can easily enough do a
\'HostA._ip < HostB._ip\'
Args:
other: An IP object.
Returns:
If the IP versions of self and other are the same, returns:
-1 if self < other:
eg: IPv4(\'1.1.1.0/24\') < IPv4(\'1.1.2.0/24\')
IPv6(\'1080::200C:417A\') < IPv6(\'1080::200B:417B\')
0 if self == other
eg: IPv4(\'1.1.1.1/24\') == IPv4(\'1.1.1.2/24\')
IPv6(\'1080::200C:417A/96\') == IPv6(\'1080::200C:417B/96\')
1 if self > other
eg: IPv4(\'1.1.1.0/24\') > IPv4(\'1.1.0.0/24\')
IPv6(\'1080::1:200C:417A/112\') >
IPv6(\'1080::0:200C:417A/112\')
If the IP versions of self and other are different, returns:
-1 if self._version < other._version
eg: IPv4(\'10.0.0.1/24\') < IPv6(\'::1/128\')
1 if self._version > other._version
eg: IPv6(\'::1/128\') > IPv4(\'255.255.255.0/24\')'

def compare_networks(self, other):

    if (self._version < other._version):
        return (-1)
    if (self._version > other._version):
        return 1
    if (self.network < other.network):
        return (-1)
    if (self.network > other.network):
        return 1
    if (self.netmask < other.netmask):
        return (-1)
    if (self.netmask > other.netmask):
        return 1
    return 0
