(ip)
return True
Return False if ip is blocked.
Return False if ip is blocked.
Return False if ip is blocked .
def ip_in_allowed_ip_range(ip):
    """ Return False if ip is blocked. """
    if not ip:
        return False
    ip = IPAddress(ip)
    for banned_ip_range in settings.BANNED_IP_RANGES:
        if IPAddress(ip) in IPNetwork(banned_ip_range):
            return False
    return True
def ip_in_allowed_ip_range ( ip ) : if not ip : return False ip = IPAddress ( ip ) for banned_ip_range in settings . BANNED_IP_RANGES : if IPAddress ( ip ) in IPNetwork ( banned_ip_range ) : return False return True