docs: def _allocate_subnets(self, conf):
          """
          Allocate all the subnets needed by the given configuration spec
  
          Args:
              conf (dict): Configuration spec where to get the nets definitions
                  from
  
          Returns:
              tuple(list, dict): allocated subnets and modified conf
          """
          allocated_subnets = []
          try:
              for net_spec in conf.get('nets', {}).itervalues():
                  if net_spec['type'] != 'nat':
                      continue
  
                  gateway = net_spec.get('gw')
                  if gateway:
                      allocated_subnet = self._subnet_store.acquire(
                          self.paths.uuid(), gateway
                      )
                  else:
                      allocated_subnet = self._subnet_store.acquire(
                          self.paths.uuid()
                      )
                      net_spec['gw'] = str(allocated_subnet.iter_hosts().next())
  
                  allocated_subnets.append(allocated_subnet)
          except:
              self._subnet_store.release(allocated_subnets)
              raise
          return allocated_subnets, conf