def view_prefix(arg, opts, shell_opts):
<EOL>try:<EOL><INDENT>ip = IPy.IP(arg)<EOL><DEDENT>except ValueError:<EOL><INDENT>arg = arg.split('<STR_LIT:/>')[<NUM_LIT:0>]<EOL><DEDENT>q = { '<STR_LIT>': arg }<EOL>v = get_vrf(opts.get('<STR_LIT>'), abort=True)<EOL>if v.rt != '<STR_LIT:all>':<EOL><INDENT>q['<STR_LIT>'] = v.rt<EOL><DEDENT>res = Prefix.list(q)<EOL>if len(res) == <NUM_LIT:0>:<EOL><INDENT>vrf_text = '<STR_LIT>'<EOL>if v.rt != '<STR_LIT:all>':<EOL><INDENT>vrf_text = vrf_format(v)<EOL><DEDENT>print("<STR_LIT>" % (arg, vrf_text), file=sys.stderr)<EOL>sys.exit(<NUM_LIT:1>)<EOL><DEDENT>p = res[<NUM_LIT:0>]<EOL>vrf = p.vrf.rt<EOL>print("<STR_LIT>")<EOL>print("<STR_LIT>" % ("<STR_LIT>", p.prefix))<EOL>print("<STR_LIT>" % ("<STR_LIT>", p.display_prefix))<EOL>print("<STR_LIT>" % ("<STR_LIT>", p.type))<EOL>print("<STR_LIT>" % ("<STR_LIT>", p.status))<EOL>print("<STR_LIT>" % ("<STR_LIT>", p.family))<EOL>print("<STR_LIT>" % ("<STR_LIT>", vrf))<EOL>print("<STR_LIT>" % ("<STR_LIT>", p.description))<EOL>print("<STR_LIT>" % ("<STR_LIT>", p.node))<EOL>print("<STR_LIT>" % ("<STR_LIT>", p.country))<EOL>print("<STR_LIT>" % ("<STR_LIT>", p.order_id))<EOL>print("<STR_LIT>" % ("<STR_LIT>", p.customer_id))<EOL>print("<STR_LIT>" % ("<STR_LIT>", p.vlan))<EOL>print("<STR_LIT>" % ("<STR_LIT>", p.alarm_priority))<EOL>print("<STR_LIT>" % ("<STR_LIT>", p.monitor))<EOL>print("<STR_LIT>" % ("<STR_LIT>", p.added))<EOL>print("<STR_LIT>" % ("<STR_LIT>", p.last_modified))<EOL>print("<STR_LIT>" % ("<STR_LIT>", p.expires or '<STR_LIT:->'))<EOL>if p.family == <NUM_LIT:4>:<EOL><INDENT>print("<STR_LIT>" % ("<STR_LIT>", p.used_addresses,<EOL>p.free_addresses, (float(p.used_addresses)/p.total_addresses)*<NUM_LIT:100>,<EOL>p.total_addresses))<EOL><DEDENT>else:<EOL><INDENT>print("<STR_LIT>" % ("<STR_LIT>", p.used_addresses,<EOL>p.free_addresses, (float(p.used_addresses)/p.total_addresses)*<NUM_LIT:100>,<EOL>p.total_addresses))<EOL><DEDENT>print("<STR_LIT>")<EOL>if p.avps is not None:<EOL><INDENT>for key in sorted(p.avps, key=lambda s: s.lower()):<EOL><INDENT>print("<STR_LIT>" % (key, p.avps[key]))<EOL><DEDENT><DEDENT>print("<STR_LIT>")<EOL>for tag_name in sorted(p.tags, key=lambda s: s.lower()):<EOL><INDENT>print("<STR_LIT>" % tag_name)<EOL><DEDENT>print("<STR_LIT>")<EOL>for tag_name in sorted(p.inherited_tags, key=lambda s: s.lower()):<EOL><INDENT>print("<STR_LIT>" % tag_name)<EOL><DEDENT>print("<STR_LIT>")<EOL>print(p.comment or '<STR_LIT>')<EOL>
View a single prefix.