def ipv6_to_longs(addr):
    """This function will turn an IPv6 into two longs. The first number
    represents the first 64 bits of the address and second represents
    the lower 64 bits.

    :param addr: IPv6 to be converted.
    :type addr: str
    :returns: (ip_upper, ip_lower) -- (int, int)
    :raises: ValidationError
    """
    try:
        ip = ipaddr.IPv6Address(addr)
    except ipaddr.AddressValueError:
        raise ValidationError("AddressValueError: Invalid IPv6 address {0}".
                              format(addr))
    # TODO, use int() instead of _int. Make sure tests pass
    ip_upper = ip._ip >> 64  # Put the last 64 bits in the first 64
    ip_lower = ip._ip & 1 - (1 << 64)  # Mask off the last sixty-four bits
    return (ip_upper, ip_lower)
dataset/ETHPy150Open mozilla/inventory/mozdns/ip/models.py/ipv6_to_longs/swapped operands of `-`