use the power, luke!
aside from various networking libraries out there, the problem is rather simple....
what you're getting back is the "alphabetical order" .
what you need instead is to sort every triplet as an integer.
In reality, python strings for ip addresses are good enough, if taken separately, i.e.
1 is lower than 10 even if "1" and "10" are strings.
so, to order your ip addresses, you just split every ip address by "."
given a list of
myips = [
'192.168.4.1',
'192.168.1.10',
'192.168.1.11',
]
what_you_want = sorted(myips, key=lambda x: x.split('.'))