def modify_prefix(arg, opts, shell_opts):
modify_confirmed = shell_opts.force<EOL>spec = { '<STR_LIT>': arg }<EOL>v = get_vrf(opts.get('<STR_LIT>'), abort=True)<EOL>spec['<STR_LIT>'] = v.rt<EOL>res = Prefix.list(spec)<EOL>if len(res) == <NUM_LIT:0>:<EOL><INDENT>print("<STR_LIT>" % (arg, vrf_format(v)), file=sys.stderr)<EOL>return<EOL><DEDENT>p = res[<NUM_LIT:0>]<EOL>if '<STR_LIT>' in opts:<EOL><INDENT>p.prefix = opts['<STR_LIT>']<EOL><DEDENT>if '<STR_LIT:description>' in opts:<EOL><INDENT>p.description = opts['<STR_LIT:description>']<EOL><DEDENT>if '<STR_LIT>' in opts:<EOL><INDENT>p.comment = opts['<STR_LIT>']<EOL><DEDENT>if '<STR_LIT>' in opts:<EOL><INDENT>tags = list(csv.reader([opts.get('<STR_LIT>', '<STR_LIT>')], escapechar='<STR_LIT:\\>'))[<NUM_LIT:0>]<EOL>p.tags = {}<EOL>for tag_name in tags:<EOL><INDENT>tag = Tag()<EOL>tag.name = tag_name<EOL>p.tags[tag_name] = tag<EOL><DEDENT><DEDENT>if '<STR_LIT>' in opts:<EOL><INDENT>p.node = opts['<STR_LIT>']<EOL><DEDENT>if '<STR_LIT:type>' in opts:<EOL><INDENT>p.type = opts['<STR_LIT:type>']<EOL><DEDENT>if '<STR_LIT:status>' in opts:<EOL><INDENT>p.status = opts['<STR_LIT:status>']<EOL><DEDENT>if '<STR_LIT>' in opts:<EOL><INDENT>p.country = opts['<STR_LIT>']<EOL><DEDENT>if '<STR_LIT>' in opts:<EOL><INDENT>p.order_id = opts['<STR_LIT>']<EOL><DEDENT>if '<STR_LIT>' in opts:<EOL><INDENT>p.customer_id = opts['<STR_LIT>']<EOL><DEDENT>if '<STR_LIT>' in opts:<EOL><INDENT>p.vlan = opts['<STR_LIT>']<EOL><DEDENT>if '<STR_LIT>' in opts:<EOL><INDENT>p.alarm_priority = opts['<STR_LIT>']<EOL><DEDENT>if '<STR_LIT>' in opts:<EOL><INDENT>p.monitor = _str_to_bool(opts['<STR_LIT>'])<EOL><DEDENT>if '<STR_LIT>' in opts:<EOL><INDENT>p.expires = opts['<STR_LIT>']<EOL><DEDENT>for avp in opts.get('<STR_LIT>', []):<EOL><INDENT>try:<EOL><INDENT>key, value = avp.split('<STR_LIT:=>', <NUM_LIT:1>)<EOL><DEDENT>except ValueError:<EOL><INDENT>print("<STR_LIT>" % avp, file=sys.stderr)<EOL>return<EOL><DEDENT>p.avps[key] = value<EOL><DEDENT>if not modify_confirmed and p.authoritative_source.lower() != '<STR_LIT>':<EOL><INDENT>res = input("<STR_LIT>" %<EOL>(p.prefix, vrf_format(p.vrf), p.authoritative_source))<EOL>if res.lower() not in [ '<STR_LIT:y>', '<STR_LIT:yes>' ]:<EOL><INDENT>print("<STR_LIT>")<EOL>return<EOL><DEDENT><DEDENT>try:<EOL><INDENT>p.save()<EOL><DEDENT>except NipapError as exc:<EOL><INDENT>print("<STR_LIT>" % str(exc), file=sys.stderr)<EOL>sys.exit(<NUM_LIT:1>)<EOL><DEDENT>print("<STR_LIT>" % (p.display_prefix, vrf_format(p.vrf)))<EOL>
Modify the prefix 'arg' with the options 'opts'