'Returns the 1 or 2 possible subnets for a nova network.'

def _get_subnets_from_network(self, context, network, instance_host=None):

    extracted_subnets = self._extract_subnets(network)
    subnets = []
    for subnet in extracted_subnets:
        subnet_dict = {'cidr': subnet['cidr'], 'gateway': network_model.IP(address=subnet['gateway'], type='gateway')}
        if self.DHCP:
            if network.get('multi_host'):
                dhcp_server = self._get_dhcp_ip(context, network, instance_host)
            else:
                dhcp_server = self._get_dhcp_ip(context, subnet)
            subnet_dict['dhcp_server'] = dhcp_server
        subnet_object = network_model.Subnet(**subnet_dict)
        for k in ['dns1', 'dns2']:
            if subnet.get(k):
                subnet_object.add_dns(network_model.IP(address=subnet[k], type='dns'))
        subnet_object['ips'] = []
        subnets.append(subnet_object)
    return subnets
