def modify_vrf(arg, opts, shell_opts):
    """ Modify a VRF with the options set in opts
    """

    res = VRF.list({ 'rt': arg })
    if len(res) < 1:
        print >> sys.stderr, "VRF with [RT: %s] not found." % arg
        sys.exit(1)

    v = res[0]

    if 'rt' in opts:
        v.rt = opts['rt']
    if 'name' in opts:
        v.name = opts['name']
    if 'description' in opts:
        v.description = opts['description']
    if 'tags' in opts:
        tags = list(csv.reader([opts.get('tags', '')], escapechar='\\'))[0]
        v.tags = {}
        for tag_name in tags:
            tag = Tag()
            tag.name = tag_name
            v.tags[tag_name] = tag

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

    v.save()

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