def is_ip_blacklisted(ipaddr):
    """Binary searches whether ip address is in a
    blacklist (reported malicious ip).

    :param ipaddr: String IP address.
    :returns: True x False.
    """
    ip = int(ipaddress.ip_address(ipaddr))
    low = 0
    high = len(ipblacklist) - 1

    while low <= high:
        mid = low + (high - low) // 2
        ipmid = ipblacklist[mid]

        if ip >= ipmid[0] and ip <= ipmid[1]:
            return True
        elif ip < ipmid[0]:
            high = mid - 1
        elif ip > ipmid[1]:
            low = mid + 1

    return False
Binary searches whether ip address is in a
    blacklist (reported malicious ip).

    :param ipaddr: String IP address.
    :returns: True x False.
    
lisa/analysis/network_analysis.py