def view_vrf(arg, opts, shell_opts):
    """ View a single 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)

    print "-- VRF"
    print "  %-26s : %d" % ("ID", v.id)
    print "  %-26s : %s" % ("RT", v.rt)
    print "  %-26s : %s" % ("Name", v.name)
    print "  %-26s : %s" % ("Description", v.description)

    print "-- Extra Attributes"
    if v.avps is not None:
        for key in sorted(v.avps, key=lambda s: s.lower()):
            print "  %-26s : %s" % (key, v.avps[key])

    print "-- Tags"
    for tag_name in sorted(v.tags, key=lambda s: s.lower()):
        print "  %s" % tag_name
    # statistics
    if v.total_addresses_v4 == 0:
        used_percent_v4 = 0
    else:
        used_percent_v4 = (float(v.used_addresses_v4)/v.total_addresses_v4)*100
    if v.total_addresses_v6 == 0:
        used_percent_v6 = 0
    else:
        used_percent_v6 = (float(v.used_addresses_v6)/v.total_addresses_v6)*100
    print "-- Statistics"
    print "  %-26s : %s" % ("IPv4 prefixes", v.num_prefixes_v4)
    print "  %-26s : %.0f / %.0f (%.2f%% of %.0f)" % ("IPv4 addresses Used / Free",
            v.used_addresses_v4, v.free_addresses_v4, used_percent_v4,
            v.total_addresses_v4)
    print "  %-26s : %s" % ("IPv6 prefixes", v.num_prefixes_v6)
    print "  %-26s : %.4e / %.4e (%.2f%% of %.4e)" % ("IPv6 addresses Used / Free",
            v.used_addresses_v6, v.free_addresses_v6, used_percent_v6,
            v.total_addresses_v6)
dataset/ETHPy150Open SpriteLink/NIPAP/nipap-cli/nipap_cli/nipap_cli.py/view_vrf