code: def vrf_attr_add(arg, opts, shell_opts):
      
  
      if arg is None:
          print("ERROR: Please specify the RT of the VRF to view.", file=sys.stderr)
          sys.exit(1)
  
      # interpret as default VRF (ie, RT = None)
      if arg.lower() in ('-', 'none'):
          arg = None
  
      try:
          v = VRF.search({
              'val1': 'rt',
              'operator': 'equals',
              'val2': arg }
              )['result'][0]
      except (KeyError, IndexError):
          print("VRF with [RT: %s] not found." % str(arg), file=sys.stderr)
          sys.exit(1)
  
      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 v.avps:
              print("Unable to add extra-attribute: '%s' already exists." % key, file=sys.stderr)
              sys.exit(1)
  
          v.avps[key] = value
  
      try:
          v.save()
      except NipapError as exc:
          print("Could not save VRF changes: %s" % str(exc), file=sys.stderr)
          sys.exit(1)
  
      print("%s saved." % vrf_format(v))
docs: Add attributes to a VRF