nvlist_print()の代替実装例。
def nvlist_print(nvlist, indent = 0):
for type, name, value in nvlist:
if not isinstance(value, list):
if type == DATA_TYPE_NVLIST:
print "%s%s:" % (" " * indent, name)
nvlist_print(value, indent + 4)
else:
print "%s%s: %s" % (" " * indent, name, value)
else:
print "%s%s:" % (" " * indent, name)
indent2 = indent + 4
for i, v in enumerate(value):
if type == DATA_TYPE_NVLIST_ARRAY:
print "%s[%d]:" % (" " * indent2, i)
nvlist_print(v, indent2 + 4)
else:
print "%s[%d]: %s" % (" " * indent2, i, v)