diff --git a/src/vpp-api/python/vpp_papi/tests/test_vpp_serializer.py b/src/vpp-api/python/vpp_papi/tests/test_vpp_serializer.py
index 4e8a417..4b47e1e 100755
--- a/src/vpp-api/python/vpp_papi/tests/test_vpp_serializer.py
+++ b/src/vpp-api/python/vpp_papi/tests/test_vpp_serializer.py
@@ -3,6 +3,7 @@
 import unittest
 from vpp_papi.vpp_serializer import VPPType, VPPEnumType
 from vpp_papi.vpp_serializer import VPPUnionType, VPPMessage
+from vpp_papi.vpp_format import VPPFormat
 from socket import inet_pton, AF_INET, AF_INET6
 import logging
 import sys
@@ -89,6 +90,65 @@
         nt, size = message_with_va_address_list.unpack(b)
         self.assertEqual(nt.is_cool, 100)
 
+    def test_recursive_address(self):
+        af = VPPEnumType('vl_api_address_family_t', [["ADDRESS_IP4", 0],
+                                                     ["ADDRESS_IP6", 1],
+                                                     {"enumtype": "u32"}])
+        ip4 = VPPType('vl_api_ip4_address_t', [['u8', 'address', 4]])
+        ip6 = VPPType('vl_api_ip6_address_t', [['u8', 'address', 16]])
+        VPPUnionType('vl_api_address_union_t',
+                     [["vl_api_ip4_address_t", "ip4"],
+                      ["vl_api_ip6_address_t", "ip6"]])
+
+        address = VPPType('vl_api_address_t',
+                          [['vl_api_address_family_t', 'af'],
+                           ['vl_api_address_union_t', 'un']])
+
+        prefix = VPPType('vl_api_prefix_t',
+                          [['vl_api_address_t', 'address'],
+                           ['u8', 'address_length']])
+        message = VPPMessage('svs',
+                          [['vl_api_prefix_t', 'prefix']])
+        message_addr = VPPMessage('svs_address',
+                                  [['vl_api_address_t', 'address']])
+
+
+        b = message_addr.pack({'address': "1::1"})
+        self.assertEqual(len(b), 20)
+        nt, size = message_addr.unpack(b)
+        self.assertEqual("1::1", VPPFormat.unformat(nt.address))
+        b = message_addr.pack({'address': "1.1.1.1"})
+        self.assertEqual(len(b), 20)
+        nt, size = message_addr.unpack(b)
+        self.assertEqual("1.1.1.1", VPPFormat.unformat(nt.address))
+
+        b = message.pack({'prefix': "1.1.1.1/24"})
+        self.assertEqual(len(b), 21)
+        nt, size = message.unpack(b)
+        self.assertEqual("1.1.1.1/24", VPPFormat.unformat(nt.prefix))
+
+    def test_zero_vla(self):
+        '''Default zero'ed out for VLAs'''
+        list = VPPType('vl_api_list_t',
+                         [['u8', 'count', 10]])
+
+        # Define an embedded VLA type
+        valist = VPPType('vl_api_valist_t',
+                         [['u8', 'count'],
+                          ['u8', 'string', 0, 'count']])
+        # Define a message
+        vamessage = VPPMessage('vamsg',
+                          [['vl_api_valist_t', 'valist'],
+                           ['u8', 'is_something']])
+
+        message = VPPMessage('msg',
+                          [['vl_api_list_t', 'list'],
+                           ['u8', 'is_something']])
+
+        # Pack message without VLA specified
+        b = message.pack({'is_something': 1})
+        b = vamessage.pack({'is_something': 1})
+
     def test_arrays(self):
         # Test cases
         # 1. Fixed list
@@ -133,7 +193,7 @@
                          inet_pton(AF_INET, '2.2.2.2'))
 
         string = 'foobar foobar'
-        b = s.pack({'length': len(string), 'string': string})
+        b = s.pack({'length': len(string), 'string': string.encode()})
         nt, size = s.unpack(b)
         self.assertEqual(len(b), size)
 
@@ -142,7 +202,7 @@
                             ['u8', 'string', 0, 'length']])
 
         string = ''
-        b = s.pack({'length': len(string), 'string': string})
+        b = s.pack({'length': len(string), 'string': string.encode()})
         nt, size = s.unpack(b)
         self.assertEqual(len(b), size)
 
diff --git a/src/vpp-api/python/vpp_papi/vpp_format.py b/src/vpp-api/python/vpp_papi/vpp_format.py
new file mode 100644
index 0000000..b1800d8
--- /dev/null
+++ b/src/vpp-api/python/vpp_papi/vpp_format.py
@@ -0,0 +1,144 @@
+#
+# Copyright (c) 2018 Cisco and/or its affiliates.
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at:
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+from socket import inet_pton, inet_ntop, AF_INET6, AF_INET
+
+
+class VPPFormat:
+    @staticmethod
+    def format_vl_api_ip6_prefix_t(args):
+        prefix, len = args.split('/')
+        return {'prefix': {'address': inet_pton(AF_INET6, prefix)},
+                'len': int(len)}
+
+    @staticmethod
+    def unformat_vl_api_ip6_prefix_t(args):
+        return "{}/{}".format(inet_ntop(AF_INET6, args.prefix.address),
+                              args.len)
+
+    @staticmethod
+    def format_vl_api_ip4_prefix_t(args):
+        prefix, len = args.split('/')
+        return {'prefix': {'address': inet_pton(AF_INET, prefix)},
+                'len': int(len)}
+
+    @staticmethod
+    def unformat_vl_api_ip4_prefix_t(args):
+        return "{}/{}".format(inet_ntop(AF_INET, args.prefix.address),
+                              args.len)
+
+    @staticmethod
+    def format_vl_api_ip6_address_t(args):
+        return {'address': inet_pton(AF_INET6, args)}
+
+    @staticmethod
+    def format_vl_api_ip4_address_t(args):
+        return {'address': inet_pton(AF_INET, args)}
+
+    @staticmethod
+    def format_vl_api_address_t(args):
+        try:
+            return {'un': {'ip6': {'address': inet_pton(AF_INET6, args)}},
+                    'af': int(1)}
+        except Exception as e:
+            return {'un': {'ip4': {'address': inet_pton(AF_INET, args)}},
+                    'af': int(0)}
+
+    @staticmethod
+    def unformat_vl_api_address_t(arg):
+        if arg.af == 1:
+            return inet_ntop(AF_INET6, arg.un.ip6.address)
+        if arg.af == 0:
+            return inet_ntop(AF_INET, arg.un.ip4.address)
+        raise
+
+    @staticmethod
+    def format_vl_api_prefix_t(args):
+        prefix, len = args.split('/')
+        return {'address': VPPFormat.format_vl_api_address_t(prefix),
+                'address_length': int(len)}
+
+    @staticmethod
+    def unformat_vl_api_prefix_t(arg):
+        if arg.address.af == 1:
+            return "{}/{}".format(inet_ntop(AF_INET6,
+                                            arg.address.un.ip6.address),
+                                  arg.address_length)
+        if arg.address.af == 0:
+            return "{}/{}".format(inet_ntop(AF_INET,
+                                            arg.address.un.ip4.address),
+                                  arg.address_length)
+        raise
+
+    @staticmethod
+    def format_u8(args):
+        try:
+            return int(args)
+        except Exception as e:
+            return args.encode()
+
+    @staticmethod
+    def format(typename, args):
+        try:
+            return getattr(VPPFormat, 'format_' + typename)(args)
+        except AttributeError:
+            # Default
+            return (int(args))
+
+    @staticmethod
+    def unformat_bytes(args):
+        try:
+            return args.decode('utf-8')
+        except Exception as e:
+            return args
+
+    @staticmethod
+    def unformat_list(args):
+        s = '['
+        for f in args:
+            t = type(f).__name__
+            if type(f) is int:
+                s2 = str(f)
+            else:
+                s2 = VPPFormat.unformat_t(t, f)
+            s += '{} '.format(s2)
+        return s[:-1] + ']'
+
+    @staticmethod
+    def unformat(args):
+        s = ''
+        return VPPFormat.unformat_t(type(args).__name__, args)
+        '''
+        for i, f in enumerate(args):
+            print('F', f)
+            t = type(f).__name__
+            if type(f) is int:
+                s2 = str(f)
+            else:
+                s2 = VPPFormat.unformat_t(t, f)
+            s += '{} {} '.format(args._fields[i], s2)
+        return s[:-1]
+        '''
+
+    @staticmethod
+    def unformat_t(typename, args):
+        try:
+            return getattr(VPPFormat, 'unformat_' + typename)(args)
+        except AttributeError:
+            # Type without explicit override
+            return VPPFormat.unformat(args)
+
+        # Default handling
+        return args
diff --git a/src/vpp-api/python/vpp_papi/vpp_papi.py b/src/vpp-api/python/vpp_papi/vpp_papi.py
index 5e98f92..2310cd1 100644
--- a/src/vpp-api/python/vpp_papi/vpp_papi.py
+++ b/src/vpp-api/python/vpp_papi/vpp_papi.py
@@ -28,6 +28,7 @@
 import atexit
 from . vpp_serializer import VPPType, VPPEnumType, VPPUnionType, BaseTypes
 from . vpp_serializer import VPPMessage, vpp_get_type
+from . vpp_format import VPPFormat
 
 if sys.version[0] == '2':
     import Queue as queue
diff --git a/src/vpp-api/python/vpp_papi/vpp_serializer.py b/src/vpp-api/python/vpp_papi/vpp_serializer.py
index 240912d..8635ce0 100644
--- a/src/vpp-api/python/vpp_papi/vpp_serializer.py
+++ b/src/vpp-api/python/vpp_papi/vpp_serializer.py
@@ -17,6 +17,7 @@
 import collections
 from enum import IntEnum
 import logging
+from .vpp_format import VPPFormat
 
 #
 # Set log-level in application by doing e.g.:
@@ -46,6 +47,8 @@
                      .format(type, base_types[type]))
 
     def pack(self, data, kwargs=None):
+        if not data:  # Default to zero if not specified
+            data = 0
         return self.packer.pack(data)
 
     def unpack(self, data, offset, result=None):
@@ -79,6 +82,8 @@
     def pack(self, list, kwargs):
         """Packs a fixed length bytestring. Left-pads with zeros
         if input data is too short."""
+        if not list:
+            return b'\x00' * self.size
         if len(list) > self.num:
             raise ValueError('Fixed list length error for "{}", got: {}'
                              ' expected: {}'
@@ -129,6 +134,8 @@
         self.length_field = len_field_name
 
     def pack(self, list, kwargs=None):
+        if not list:
+            return b""
         if len(list) != kwargs[self.length_field]:
             raise ValueError('Variable length error, got: {} expected: {}'
                              .format(len(list), kwargs[self.length_field]))
@@ -213,7 +220,7 @@
         return True
 
     def pack(self, data, kwargs=None):
-        return types['u32'].pack(data, kwargs)
+        return types['u32'].pack(data)
 
     def unpack(self, data, offset=0, result=None):
         x, size = types['u32'].unpack(data, offset)
@@ -246,7 +253,11 @@
         self.tuple = collections.namedtuple(name, fields, rename=True)
         logger.debug('Adding union {}'.format(name))
 
+    # Union of variable length?
     def pack(self, data, kwargs=None):
+        if not data:
+            return b'\x00' * self.size
+
         for k, v in data.items():
             logger.debug("Key: {} Value: {}".format(k, v))
             b = self.packers[k].pack(v, kwargs)
@@ -319,14 +330,32 @@
             kwargs = data
         b = bytes()
         for i, a in enumerate(self.fields):
-            if a not in data:
-                b += b'\x00' * self.packers[i].size
-                continue
+
+            # Try one of the format functions
+            if data and type(data) is not dict and a not in data:
+                raise ValueError("Invalid argument: {} expected {}.{}".
+                                 format(data, self.name, a))
+
+            # Defaulting to zero.
+            if not data or a not in data:  # Default to 0
+                arg = None
+                kwarg = None  # No default for VLA
+            else:
+                arg = data[a]
+                kwarg = kwargs[a] if a in kwargs else None
 
             if isinstance(self.packers[i], VPPType):
-                b += self.packers[i].pack(data[a], kwargs[a])
+                try:
+                    b += self.packers[i].pack(arg, kwarg)
+                except ValueError:
+                    # Invalid argument, can we convert it?
+                    arg = VPPFormat.format(self.packers[i].name, data[a])
+                    data[a] = arg
+                    kwarg = arg
+                    b += self.packers[i].pack(arg, kwarg)
             else:
-                b += self.packers[i].pack(data[a], kwargs)
+                b += self.packers[i].pack(arg, kwargs)
+
         return b
 
     def unpack(self, data, offset=0, result=None):
diff --git a/src/vpp-api/python/vpp_papi/vpp_stats.py b/src/vpp-api/python/vpp_papi/vpp_stats.py
index 8c1aaf2..76e1e54 100644
--- a/src/vpp-api/python/vpp_papi/vpp_stats.py
+++ b/src/vpp-api/python/vpp_papi/vpp_stats.py
@@ -62,7 +62,8 @@
     if type(strings) is not list:
         strings = [strings]
     for s in strings:
-        vec = api.stat_segment_string_vector(vec, ffi.new("char []", s.encode()))
+        vec = api.stat_segment_string_vector(vec, ffi.new("char []",
+                                                          s.encode()))
     return vec
 
 
@@ -134,7 +135,7 @@
         for i in range(rv_len):
             n = ffi.string(rv[i].name).decode()
             e = stat_entry_to_python(self.api, rv[i])
-            if e != None:
+            if e is not None:
                 stats[n] = e
         return stats
 
@@ -144,7 +145,7 @@
             try:
                 dir = self.ls(name)
                 return self.dump(dir).values()[0]
-            except:
+            except Exception as e:
                 if retries > 10:
                     return None
                 retries += 1
@@ -161,7 +162,7 @@
                 error_names = self.ls(['/err/'])
                 error_counters = self.dump(error_names)
                 break
-            except:
+            except Exception as e:
                 if retries > 10:
                     return None
                 retries += 1
