code: def alloc_retrieve_subnet_info(self, tenant_id, direc):
          
          serv_obj = self.get_service_obj(tenant_id)
          subnet_dict = self.retrieve_dcnm_subnet_info(tenant_id, direc)
          if subnet_dict:
              return subnet_dict
          ip_subnet_dict = self.get_next_ip(tenant_id, direc)
          subnet_dict = self.fill_dcnm_subnet_info(
              tenant_id, ip_subnet_dict.get('subnet'),
              ip_subnet_dict.get('start'), ip_subnet_dict.get('end'),
              ip_subnet_dict.get('gateway'), ip_subnet_dict.get('sec_gateway'),
              direc)
          serv_obj.store_dcnm_subnet_dict(subnet_dict, direc)
          return subnet_dict
docs: Allocate and store Subnet.
  
          This function initially checks if subnet is allocated for a tenant
          for the in/out direction. If not, it calls routine to allocate a subnet
          and stores it on tenant object.