code: def add_pool(self, auth, attr):
          
  
          self._logger.debug("add_pool called; attrs: %s" % unicode(attr))
  
          # sanity check - do we have all attributes?
          req_attr = ['name', 'description', 'default_type']
          self._check_pool_attr(attr, req_attr)
  
          insert, params = self._sql_expand_insert(attr)
          sql = "INSERT INTO ip_net_pool " + insert
  
          self._execute(sql, params)
          pool_id = self._lastrowid()
          pool = self.list_pool(auth, { 'id': pool_id })[0]
  
          # write to audit table
          audit_params = {
              'pool_id': pool['id'],
              'pool_name': pool['name'],
              'username': auth.username,
              'authenticated_as': auth.authenticated_as,
              'full_name': auth.full_name,
              'authoritative_source': auth.authoritative_source,
              'description': 'Added pool %s with attr: %s' % (pool['name'], unicode(attr))
          }
          sql, params = self._sql_expand_insert(audit_params)
          self._execute('INSERT INTO ip_net_log %s' % sql, params)
  
          return pool
docs: Create a pool according to `attr`.
  
              * `auth` [BaseAuth]
                  AAA options.
              * `attr` [pool_attr]
                  A dict containing the attributes the new pool should have.
  
              Returns a dict describing the pool which was added.
  
              This is the documentation of the internal backend function. It's
              exposed over XML-RPC, please also see the XML-RPC documentation for
              :py:func:`nipap.xmlrpc.NipapXMLRPC.add_pool` for full
              understanding.