In general, you can pack any of the most common XDR data types by calling the
appropriate pack_type() method. Each method takes a single argument, the
value to pack. The following simple data type packing methods are supported:
pack_uint(), pack_int(), pack_enum(), pack_bool(),
pack_uhyper(), and pack_hyper().

Packs a list of homogeneous items. This method is useful for lists with an
indeterminate size; i.e. the size is not available until the entire list has
been walked. For each item in the list, an unsigned integer 1 is packed
first, followed by the data value from the list. pack_item is the function
that is called to pack the individual item. At the end of the list, an unsigned
integer 0 is packed.

For example, to pack a list of integers, the code might appear like this:

Packs a fixed length list (array) of homogeneous items. n is the length of
the list; it is not packed into the buffer, but a ValueError exception
is raised if len(array) is not equal to n. As above, pack_item is the
function used to pack each element.

Indicates unpack completion. Raises an Error exception if all of the
data has not been unpacked.

In addition, every data type that can be packed with a Packer, can be
unpacked with an Unpacker. Unpacking methods are of the form
unpack_type(), and take no arguments. They return the unpacked object.

Unpacks and returns a list of homogeneous items. The list is unpacked one
element at a time by first unpacking an unsigned integer flag. If the flag is
1, then the item is unpacked and appended to the list. A flag of 0
indicates the end of the list. unpack_item is the function that is called to
unpack the items.