code: def prefix_attr_add(arg, opts, shell_opts):
      
  
      spec = { 'prefix': arg }
      v = get_vrf(opts.get('vrf_rt'), abort=True)
      spec['vrf_rt'] = v.rt
  
      res = Prefix.list(spec)
      if len(res) == 0:
          print("Prefix %s not found in %s." % (arg, vrf_format(v)), file=sys.stderr)
          return
  
      p = res[0]
  
      for avp in opts.get('extra-attribute', []):
          try:
              key, value = avp.split('=', 1)
          except ValueError:
              print("ERROR: Incorrect extra-attribute: %s. Accepted form: 'key=value'\n" % avp, file=sys.stderr)
              sys.exit(1)
  
          if key in p.avps:
              print("Unable to add extra-attribute: '%s' already exists." % key, file=sys.stderr)
              sys.exit(1)
  
          p.avps[key] = value
  
      try:
          p.save()
      except NipapError as exc:
          print("Could not save prefix changes: %s" % str(exc), file=sys.stderr)
          sys.exit(1)
  
      print("Prefix %s in %s saved." % (p.display_prefix, vrf_format(p.vrf)))
docs: Add attributes to a prefix