import struct
import socket


def convertIpToInt(i):
    """Convert the supplied argument to an int representing an IP address."""
    if isinstance(i, int):
        return i
    return struct.unpack('I', socket.inet_aton(i))[0]