def filter_ip_for_networks(ip_to_filter, whitelist_networks):
    """
    Filters ip for networks

    :param ip_to_filter: IPv4 which is filtered
    :param whitelist_networks: Array of networks for which IP is checked
    :return: True if ip belongs to any of the whitelisted networks, false otherwise
    """
    for network in whitelist_networks:
        if ip_to_filter in network:
            return True
    return False