import struct
import socket


def ip_to_int(addr):
    """
    Converts a ip address (string) to it's numeric representation (int)

    Example:
    >>> ip_to_int('127.0.0.1')
    2130706433
    """
    return struct.unpack("!I", socket.inet_aton(addr))[0]