def vrf_attr_add(arg, opts, shell_opts):
    """ Add attributes to a VRF
    """

    if arg is None:
        print >> sys.stderr, "ERROR: Please specify the RT of the VRF to view."
        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, __HOLE__):
        print >> sys.stderr, "VRF with [RT: %s] not found." % str(arg)
        sys.exit(1)

    for avp in opts.get('extra-attribute', []):
        try:
            key, value = avp.split('=', 1)
        except ValueError:
            print >> sys.stderr, "ERROR: Incorrect extra-attribute: %s. Accepted form: 'key=value'\n" % avp
            sys.exit(1)

        if key in v.avps:
            print >> sys.stderr, "Unable to add extra-attribute: '%s' already exists." % key
            sys.exit(1)

        v.avps[key] = value

    try:
        v.save()
    except NipapError as exc:
        print >> sys.stderr, "Could not save VRF changes: %s" % str(exc)
        sys.exit(1)

    print "%s saved." % vrf_format(v)
dataset/ETHPy150Open SpriteLink/NIPAP/nipap-cli/nipap_cli/nipap_cli.py/vrf_attr_add