code: def edit_asn(self, auth, asn, attr):
          
  
          self._logger.debug("edit_asn called; asn: %s attr: %s" %
                  (unicode(asn), unicode(attr)))
  
          # sanity check - do we have all attributes?
          req_attr = [ ]
          allowed_attr = [ 'name', ]
          self._check_attr(attr, req_attr, allowed_attr)
  
          asns = self.list_asn(auth, asn)
  
          where, params1 = self._expand_asn_spec(asn)
          update, params2 = self._sql_expand_update(attr)
          params = dict(params2.items() + params1.items())
  
          sql = "UPDATE ip_net_asn SET " + update + " WHERE " + where
          sql += " RETURNING *"
  
          self._execute(sql, params)
          updated_asns = []
          for row in self._curs_pg:
              updated_asns.append(dict(row))
  
          # write to audit table
          for a in asns:
              audit_params = {
                  'username': auth.username,
                  'authenticated_as': auth.authenticated_as,
                  'full_name': auth.full_name,
                  'authoritative_source': auth.authoritative_source
              }
              audit_params['description'] = 'Edited ASN %s attr: %s' % (unicode(a['asn']), unicode(attr))
  
              sql, params = self._sql_expand_insert(audit_params)
              self._execute('INSERT INTO ip_net_log %s' % sql, params)
  
          return updated_asns
docs: Edit AS number
  
              * `auth` [BaseAuth]
                  AAA options.
              * `asn` [integer]
                  AS number to edit.
              * `attr` [asn_attr]
                  New AS attributes.
  
              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.edit_asn` for full
              understanding.