def find_containing_network(ip_ranges, address):
 addr = ipaddress.ip_address(address)
 for network in ip_ranges:
  if (addr in network):
   return network
 return None

def find_containing_network ( ip_ranges , address ) : addr = ipaddress . ip_address ( address ) for network in ip_ranges : if ( addr in network ) : return network return None
find an ip network that contains the given address .