def ipv4_int(ipv4_str):
    """Returns an integer corresponding to the given ipV4 address."""
    parts = ipv4_str.split('.')
    if len(parts) != 4:
        raise Exception('Incorrect IPv4 address format: %s' % ipv4_str)

    addr_int = 0
    for part in parts:
        part_int = 0
        try:
            part_int = int(part)
        except:
            raise Exception('Incorrect IPv4 address format: %s' % ipv4_str)
        addr_int = addr_int * 256 + part_int
    return addr_int