DISPATCH-1814 use autopep8 to reformat Python code for PEP 8 (#1053)

diff --git a/docs/man/help2txt.py b/docs/man/help2txt.py
index 440f3bc..41595a6 100644
--- a/docs/man/help2txt.py
+++ b/docs/man/help2txt.py
@@ -27,7 +27,8 @@
 
 from subprocess import Popen, PIPE, CalledProcessError
 
-import re, sys
+import re
+import sys
 
 IS_PY2 = sys.version_info[0] == 2
 if IS_PY2:
@@ -35,6 +36,7 @@
 else:
     PY_STRING_TYPE = str
 
+
 def check_output(args, stdin=None, stderr=None, shell=False, universal_newlines=False, **kwargs):
     """
     Run command args and return its output as a byte string.
@@ -52,12 +54,13 @@
         raise e
     return out
 
+
 def help2txt(help_out):
     VALUE = r"(?:[\w-]+|<[^>]+>)"
     DEFAULT = r"(?: +\([^)]+\))?"
-    OPTION = r"-[\w-]+(?:[ =]%s)?%s" % (VALUE, DEFAULT) # -opt[(=| )value][(default)]
+    OPTION = r"-[\w-]+(?:[ =]%s)?%s" % (VALUE, DEFAULT)  # -opt[(=| )value][(default)]
     OPTIONS = r"%s(?:, *%s)*" % (OPTION, OPTION)        # opt[,opt...]
-    HELP = r"(?:[ \t]+\w.*$)|(?:(?:\n[ \t]+[^-\s].*$)+)" # same line or following lines indented.
+    HELP = r"(?:[ \t]+\w.*$)|(?:(?:\n[ \t]+[^-\s].*$)+)"  # same line or following lines indented.
     OPT_HELP = r"^\s+(%s)(%s)" % (OPTIONS, HELP)
     SUBHEAD = r"^((?: +\w+)*):$"
 
@@ -66,11 +69,12 @@
         help_out = help_out.decode()
 
     options = re.search("^Options:$", help_out, re.IGNORECASE | re.MULTILINE)
-    if (options): help_out = help_out[options.end():]
+    if (options):
+        help_out = help_out[options.end():]
     result = ""
 
     def heading(text, depth):
-        return "%s %s\n\n" % ("="*depth, text)
+        return "%s %s\n\n" % ("=" * depth, text)
 
     for item in re.finditer(r"%s|%s" % (OPT_HELP, SUBHEAD), help_out, re.IGNORECASE | re.MULTILINE):
         if item.group(3):
@@ -79,12 +83,14 @@
             result += "%s\n:   %s\n\n" % (item.group(1), re.sub(r"\s+", " ", item.group(2)).strip())
     return result
 
+
 def main(argv):
-    if len(argv) < 2: raise ValueError("Wrong number of arguments\nUsage %s"
-                                       " <program> [args,...]" % argv[0])
+    if len(argv) < 2:
+        raise ValueError("Wrong number of arguments\nUsage %s"
+                         " <program> [args,...]" % argv[0])
     program = argv[1:]
     print(help2txt(check_output(program)))
 
+
 if __name__ == "__main__":
     main(sys.argv)
-
diff --git a/docs/man/qdrouterd.conf.5.py b/docs/man/qdrouterd.conf.5.py
index 5ff133c..a5eea39 100644
--- a/docs/man/qdrouterd.conf.5.py
+++ b/docs/man/qdrouterd.conf.5.py
@@ -53,8 +53,6 @@
                 return
         super(ManPageWriter, self).attribute_type(attr, holder, show_create=False, show_update=False)
 
-
-
     def man_page(self):
         self.writeln(r"""
 qdrouterd.conf(5)
@@ -159,5 +157,6 @@
 http://qpid.apache.org/components/dispatch-router
 """)
 
+
 if __name__ == '__main__':
     ManPageWriter().man_page()
diff --git a/python/qpid_dispatch/management/client.py b/python/qpid_dispatch/management/client.py
index fa0e296..63b3c99 100644
--- a/python/qpid_dispatch/management/client.py
+++ b/python/qpid_dispatch/management/client.py
@@ -33,6 +33,7 @@
 from .entity import EntityBase, clean_dict
 from proton.utils import SyncRequestResponse, BlockingConnection
 
+
 class Entity(EntityBase):
     """
     Proxy for an AMQP manageable entity.
@@ -52,7 +53,7 @@
 
     def __init__(self, node, attributes=None, **kwattrs):
         super(Entity, self).__init__(attributes, **kwattrs)
-        self.__dict__['_node'] = node # Avoid getattr recursion
+        self.__dict__['_node'] = node  # Avoid getattr recursion
 
     def call(self, operation, expect=OK, **arguments):
         """Call an arbitrary management method on this entity"""
@@ -104,9 +105,9 @@
                                   timeout=timeout,
                                   ssl_domain=ssl_domain,
                                   sasl_enabled=sasl_enabled,
-                                  allowed_mechs=str(sasl.mechs) if sasl and sasl.mechs != None else None,
-                                  user=str(sasl.user) if sasl and sasl.user != None else None,
-                                  password=str(sasl.password) if sasl and sasl.password != None else None)
+                                  allowed_mechs=str(sasl.mechs) if sasl and sasl.mechs is not None else None,
+                                  user=str(sasl.user) if sasl and sasl.user is not None else None,
+                                  password=str(sasl.password) if sasl and sasl.password is not None else None)
 
     @staticmethod
     def connect(url=None, router=None, timeout=10, ssl_domain=None, sasl=None,
@@ -137,7 +138,7 @@
         @param connection: a L{BlockingConnection} to the management agent.
         """
         self.name = self.identity = u'self'
-        self.type = u'org.amqp.management' # AMQP management node type
+        self.type = u'org.amqp.management'  # AMQP management node type
         self.locales = locales
 
         self.locales = locales
@@ -149,7 +150,7 @@
 
     def set_client(self, url_path):
         if url_path:
-            self.url.path = u'%s'%url_path
+            self.url.path = u'%s' % url_path
             self.client = SyncRequestResponse(self.connection, self.url.path)
 
     def close(self):
@@ -159,7 +160,7 @@
             self.client = None
 
     def __repr__(self):
-        return "%s(%s)"%(self.__class__.__name__, self.url)
+        return "%s(%s)" % (self.__class__.__name__, self.url)
 
     @staticmethod
     def check_response(response, expect=OK):
@@ -182,7 +183,8 @@
         @param properties: Keyword arguments for application-properties of the request.
         @return: L{proton.Message} containining the management request.
         """
-        if self.locales: properties.setdefault(u'locales', self.locales)
+        if self.locales:
+            properties.setdefault(u'locales', self.locales)
         request = proton.Message()
         request.properties = clean_dict(properties)
         request.body = body or {}
@@ -207,6 +209,7 @@
         @ivar attribute_names: List of attribute names for the results.
         @ivar results: list of lists of attribute values in same order as attribute_names
         """
+
         def __init__(self, node, attribute_names, results):
             """
             @param response: the respose message to a query.
@@ -221,15 +224,18 @@
             @param clean: if True remove any None values from returned dictionaries.
             """
             for r in self.results:
-                if clean: yield clean_dict(zip(self.attribute_names, r))
-                else: yield dict(zip(self.attribute_names, r))
+                if clean:
+                    yield clean_dict(zip(self.attribute_names, r))
+                else:
+                    yield dict(zip(self.attribute_names, r))
 
         def iter_entities(self, clean=False):
             """
             Return an iterator that yields an L{Entity} for each result.
             @param clean: if True remove any None values from returned dictionaries.
             """
-            for d in self.iter_dicts(clean=clean): yield Entity(self.node, d)
+            for d in self.iter_dicts(clean=clean):
+                yield Entity(self.node, d)
 
         def get_dicts(self, clean=False):
             """Results as list of dicts."""
@@ -240,7 +246,7 @@
             return [d for d in self.iter_entities(clean=clean)]
 
         def __repr__(self):
-            return "QueryResponse(attribute_names=%r, results=%r"%(self.attribute_names, self.results)
+            return "QueryResponse(attribute_names=%r, results=%r" % (self.attribute_names, self.results)
 
     def query(self, type=None, attribute_names=None, offset=None, count=None):
         """
@@ -265,7 +271,7 @@
         if offset is None:
             offset = 0
 
-        if count is None or count==0:
+        if count is None or count == 0:
             # count has not been specified. For each request the
             # maximum number of rows we can get without proton
             # failing is MAX_ALLOWED_COUNT_PER_REQUEST
@@ -330,7 +336,8 @@
         @param identity: Entity identity.
         @return: An L{Entity}
         """
-        if name and identity: name = None # Only specify one
+        if name and identity:
+            name = None  # Only specify one
         request = self.request(operation=u'READ', type=type, name=name, identity=identity)
         return Entity(self, self.call(request).body)
 
@@ -351,7 +358,8 @@
         type = type or attributes.get(u'type')
         name = name or attributes.get(u'name')
         identity = identity or attributes.get(u'identity')
-        if name and identity: name = None # Only send one
+        if name and identity:
+            name = None  # Only send one
         request = self.request(operation=U'UPDATE', type=type, name=name,
                                identity=identity, body=self.clean_attrs(attributes))
         return Entity(self, self.call(request).body)
@@ -365,7 +373,8 @@
         @param name: Entity name.
         @param identity: Entity identity.
         """
-        if name and identity: name = None # Only specify one
+        if name and identity:
+            name = None  # Only specify one
         request = self.request(operation=U'DELETE', type=type, name=name,
                                identity=identity)
         self.call(request, expect=NO_CONTENT)
@@ -389,4 +398,4 @@
         return self.call(self.node_request(operation=u"GET-LOG", entityType=type, limit=limit)).body
 
     def get_schema(self, type=None):
-        return self.call(self.node_request(operation=u"GET-SCHEMA")).body
\ No newline at end of file
+        return self.call(self.node_request(operation=u"GET-SCHEMA")).body
diff --git a/python/qpid_dispatch/management/entity.py b/python/qpid_dispatch/management/entity.py
index 5c86cdf..e855d02 100644
--- a/python/qpid_dispatch/management/entity.py
+++ b/python/qpid_dispatch/management/entity.py
@@ -26,7 +26,8 @@
 from __future__ import absolute_import
 from __future__ import print_function
 
-import itertools, re
+import itertools
+import re
 import sys
 
 
@@ -35,6 +36,7 @@
     # luckily all strings are unicode to start with
     def unicode(s):
         return s
+
     def dict_iteritems(d):
         return iter(d.items())
 else:
@@ -42,17 +44,18 @@
         return d.iteritems()
 
 
-
 def clean_dict(items, **kwargs):
     """
     @param items: A mapping or iterable of pairs.
     @return: dict containing items + kwargs without any None values. All keys are unicode.
     """
-    if isinstance(items, dict): items = dict_iteritems(items)
+    if isinstance(items, dict):
+        items = dict_iteritems(items)
     return dict((unicode(k), v) for k, v in itertools.chain(items,
                                                             dict_iteritems(kwargs))
                 if v is not None)
 
+
 class EntityBase(object):
     """
     A collection of named attributes.
@@ -123,27 +126,35 @@
                       key=lambda k: self._SPECIAL.get(k, 3))
         return "Entity(%s)" % ", ".join("%s=%s" % (k, self.attributes[k]) for k in keys)
 
+
 def update(entity, values):
     """Update entity from values
     @param entity: an Entity
     @param values: a map of values
     """
-    for k, v in dict_iteritems(values): entity[k] = v
+    for k, v in dict_iteritems(values):
+        entity[k] = v
+
 
 SEPARATOR_RE = re.compile(r' |_|-|\.')
 
+
 def camelcase(str, capital=False):
     """Convert string str with ' ', '_', '.' or '-' separators to camelCase."""
-    if not str: return ''
+    if not str:
+        return ''
     words = SEPARATOR_RE.split(str)
     first = words[0]
-    if capital: first = first[0].upper() + first[1:]
+    if capital:
+        first = first[0].upper() + first[1:]
     return first + ''.join([w.capitalize() for w in words[1:]])
 
+
 CAPS_RE = re.compile('[A-Z]')
 
+
 def uncamelcase(str, separator='_'):
     """Convert camelCase string str to string with separator, e.g. camel_case"""
-    if len(str) == 0: return str
-    return str[0] + CAPS_RE.sub(lambda m: separator+m.group(0).lower(), str[1:])
-
+    if len(str) == 0:
+        return str
+    return str[0] + CAPS_RE.sub(lambda m: separator + m.group(0).lower(), str[1:])
diff --git a/python/qpid_dispatch/management/error.py b/python/qpid_dispatch/management/error.py
index 9c2aa4b..b3911c6 100644
--- a/python/qpid_dispatch/management/error.py
+++ b/python/qpid_dispatch/management/error.py
@@ -27,7 +27,7 @@
 from __future__ import print_function
 
 #from httplib import responses as STATUS_TEXT
-#from httplib import OK, NO_CONTENT, CREATED, \
+# from httplib import OK, NO_CONTENT, CREATED, \
 #    BAD_REQUEST, UNAUTHORIZED, FORBIDDEN, NOT_FOUND, INTERNAL_SERVER_ERROR, NOT_IMPLEMENTED
 
 OK = 200
@@ -97,6 +97,7 @@
     @ivar status: integer status code.
     @ivar description: detailed description of error.
     """
+
     def __init__(self, status, description):
         self.status, self.description = status, description
         super(ManagementError, self).__init__(description)
@@ -110,18 +111,37 @@
         except KeyError:
             return ManagementError(status, description)
 
+
 def _error_class(status):
     """Create a ManagementError class for a particular status"""
     class Error(ManagementError):
         def __init__(self, description): ManagementError.__init__(self, status, description)
     return Error
 
-class BadRequestStatus(_error_class(BAD_REQUEST)): pass
-class UnauthorizedStatus(_error_class(UNAUTHORIZED)): pass
-class ForbiddenStatus(_error_class(FORBIDDEN)): pass
-class NotFoundStatus(_error_class(NOT_FOUND)): pass
-class InternalServerErrorStatus(_error_class(INTERNAL_SERVER_ERROR)): pass
-class NotImplementedStatus(_error_class(NOT_IMPLEMENTED)): pass
+
+class BadRequestStatus(_error_class(BAD_REQUEST)):
+    pass
+
+
+class UnauthorizedStatus(_error_class(UNAUTHORIZED)):
+    pass
+
+
+class ForbiddenStatus(_error_class(FORBIDDEN)):
+    pass
+
+
+class NotFoundStatus(_error_class(NOT_FOUND)):
+    pass
+
+
+class InternalServerErrorStatus(_error_class(INTERNAL_SERVER_ERROR)):
+    pass
+
+
+class NotImplementedStatus(_error_class(NOT_IMPLEMENTED)):
+    pass
+
 
 __all__ = [
     u"STATUS_TEXT", u"OK", u"NO_CONTENT", u"CREATED",
diff --git a/python/qpid_dispatch_internal/compat/__init__.py b/python/qpid_dispatch_internal/compat/__init__.py
index 9120ed2..a6e6a69 100644
--- a/python/qpid_dispatch_internal/compat/__init__.py
+++ b/python/qpid_dispatch_internal/compat/__init__.py
@@ -56,6 +56,7 @@
     else:
         return od
 
+
 IS_PY2 = sys.version_info[0] == 2
 
 if IS_PY2:
@@ -64,18 +65,25 @@
     PY_BINARY_TYPE = str
     PY_INTEGER_TYPES = (int, long)  # noqa: F821
     PY_LONG_TYPE = long  # noqa: F821
+
     def dict_iterkeys(d):
         return d.iterkeys()
+
     def dict_itervalues(d):
         return d.itervalues()
+
     def dict_iteritems(d):
         return d.iteritems()
+
     def dict_keys(d):
         return d.keys()
+
     def dict_values(d):
         return d.values()
+
     def dict_items(d):
         return d.items()
+
     def BINARY(s):
         ts = type(s)
         if ts is str:
@@ -84,6 +92,7 @@
             return s.encode("utf-8")
         else:
             raise TypeError("%s cannot be converted to binary" % ts)
+
     def UNICODE(s):
         if type(s) is str:
             return s.decode("utf-8")
@@ -91,6 +100,7 @@
             return s
         else:
             return unicode(str(s), "utf-8")  # noqa: F821
+
     def LONG(i):
         return long(i)  # noqa: F821
 else:
@@ -99,21 +109,28 @@
     PY_BINARY_TYPE = bytes
     PY_INTEGER_TYPES = (int,)
     PY_LONG_TYPE = int
+
     def dict_iterkeys(d):
         return iter(d.keys())
+
     def dict_itervalues(d):
         return iter(d.values())
+
     def dict_iteritems(d):
         return iter(d.items())
     # .keys(), .items(), .values()
     # now return a dict_view not a list. Should be ok unless dict is modified
     # when iterating over it. Use these if that's the case:
+
     def dict_keys(d):
         return list(d.keys())
+
     def dict_values(d):
         return list(d.values())
+
     def dict_items(d):
         return list(d.items())
+
     def BINARY(s):
         st = type(s)
         if st is str:
@@ -122,6 +139,7 @@
             return s
         else:
             raise TypeError("%s cannot be converted to binary" % st)
+
     def UNICODE(s):
         if type(s) is bytes:
             return s.decode("utf-8")
@@ -129,5 +147,6 @@
             return s
         else:
             return str(s)
+
     def LONG(i):
         return int(i)
diff --git a/python/qpid_dispatch_internal/dispatch.py b/python/qpid_dispatch_internal/dispatch.py
index b4517f1..3456b5c 100644
--- a/python/qpid_dispatch_internal/dispatch.py
+++ b/python/qpid_dispatch_internal/dispatch.py
@@ -35,15 +35,18 @@
 from __future__ import print_function
 
 
-import sys, ctypes
+import sys
+import ctypes
 from ctypes import c_char_p, c_long, py_object
 import qpid_dispatch_site
 from .compat import IS_PY2
 
+
 class CError(Exception):
     """Exception raised if there is an error in a C call"""
     pass
 
+
 class QdDll(ctypes.PyDLL):
     """
     Load the library, set up function prototypes.
@@ -51,6 +54,7 @@
     NOTE: We use the python calling convention because the C library
     internally makes python calls.
     """
+
     def __init__(self, handle):
         super(QdDll, self).__init__("qpid-dispatch", handle=handle)
 
@@ -140,16 +144,19 @@
 # testing code.
 FORBIDDEN = ["proton"]
 
+
 def check_forbidden():
     bad = set(FORBIDDEN) & set(sys.modules)
     if bad:
         raise ImportError("Forbidden modules loaded: '%s'." % "', '".join(bad))
 
+
 def import_check(name, *args, **kw):
     if name in FORBIDDEN:
         raise ImportError("Python code running inside a dispatch router cannot import '%s', use the 'dispatch' module for internal messaging" % name)
     return builtin_import(name, *args, **kw)
 
+
 check_forbidden()
 if IS_PY2:
     import __builtin__ as builtins
diff --git a/python/qpid_dispatch_internal/display_name/display_name.py b/python/qpid_dispatch_internal/display_name/display_name.py
index 2f3c5dc..2d7f685 100644
--- a/python/qpid_dispatch_internal/display_name/display_name.py
+++ b/python/qpid_dispatch_internal/display_name/display_name.py
@@ -38,6 +38,7 @@
 from ..dispatch import IoAdapter, LogAdapter, LOG_INFO, LOG_ERROR, LOG_TRACE, LOG_STACK_LIMIT
 import json
 
+
 class SSLProfile(object):
     def __init__(self, profile_name, profile_file):
         super(SSLProfile, self).__init__()
@@ -52,6 +53,7 @@
     def __repr__(self):
         return "SSLProfile(%s)" % ", ".join("%s=%s" % (k, self.cache[k]) for k in self.cache.keys())
 
+
 class DisplayNameService(object):
 
     def __init__(self):
@@ -62,7 +64,7 @@
         self.log_adapter = LogAdapter("DISPLAYNAME")
 
     def log(self, level, text):
-        info = traceback.extract_stack(limit=2)[0] # Caller frame info
+        info = traceback.extract_stack(limit=2)[0]  # Caller frame info
         self.log_adapter.log(level, text, info[0], info[1])
 
     def add(self, profile_name, profile_file_location):
@@ -96,5 +98,3 @@
             return user_name if user_name else user_id
         else:
             return user_id
-
-
diff --git a/python/qpid_dispatch_internal/management/__init__.py b/python/qpid_dispatch_internal/management/__init__.py
index 6ee5966..d8c2fb1 100644
--- a/python/qpid_dispatch_internal/management/__init__.py
+++ b/python/qpid_dispatch_internal/management/__init__.py
@@ -17,4 +17,3 @@
 # under the License.
 #
 """Qpid Dispatch internal management package."""
-
diff --git a/python/qpid_dispatch_internal/management/agent.py.in b/python/qpid_dispatch_internal/management/agent.py.in
index 606fac8..99a25da 100644
--- a/python/qpid_dispatch_internal/management/agent.py.in
+++ b/python/qpid_dispatch_internal/management/agent.py.in
@@ -66,7 +66,9 @@
 from __future__ import absolute_import
 from __future__ import print_function
 
-import traceback, json, pstats
+import traceback
+import json
+import pstats
 import socket
 import unicodedata
 from traceback import format_exc
@@ -103,12 +105,14 @@
     """Stringify a dict in the form 'k=v, k=v ...' instead of '{k:v, ...}'"""
     return ", ".join("%s=%s" % (k, v) for k, v in dict_iteritems(d))
 
+
 def required_property(prop, request):
     """Raise exception if required property is missing"""
     if not request.properties or prop not in request.properties:
-        raise BadRequestStatus("No '%s' property: %s"%(prop, request))
+        raise BadRequestStatus("No '%s' property: %s" % (prop, request))
     return request.properties[prop]
 
+
 def not_implemented(operation, entity_type):
     """Raise NOT_IMPLEMENTED exception"""
     raise NotImplementedStatus("Operation '%s' not implemented on %s"  % (operation, entity_type))
@@ -116,6 +120,7 @@
 
 class AtomicCount(object):
     """Simple atomic counter"""
+
     def __init__(self, count=0):
         self.count = count
         self.lock = Lock()
@@ -129,12 +134,14 @@
 
 class Implementation(object):
     """Abstract implementation wrapper"""
+
     def __init__(self, entity_type, key):
         self.entity_type, self.key = entity_type, key
 
 
 class CImplementation(Implementation):
     """Wrapper for a C implementation pointer"""
+
     def __init__(self, qd, entity_type, pointer):
         super(CImplementation, self).__init__(entity_type, pointer)
         fname = "qd_entity_refresh_" + entity_type.short_name.replace('.', '_')
@@ -146,6 +153,7 @@
 
 class PythonImplementation(Implementation):
     """Wrapper for a Python implementation object"""
+
     def __init__(self, entity_type, impl):
         """impl.refresh_entity(attributes) must be a valid function call"""
         super(PythonImplementation, self).__init__(entity_type, id(impl))
@@ -192,8 +200,10 @@
         Generate identifier. identity=type/identifier.
         Default is per-type counter, derived classes can override.
         """
-        try: counter = type(self)._identifier_count
-        except AttributeError: counter = type(self)._identifier_count = AtomicCount()
+        try:
+            counter = type(self)._identifier_count
+        except AttributeError:
+            counter = type(self)._identifier_count = AtomicCount()
         return str(counter.next())
 
     def _refresh(self):
@@ -215,7 +225,7 @@
         request_type = self.entity_type.schema.long_name(request.properties.get('type'))
         if request_type and self.type != request_type:
             raise NotFoundStatus("Entity type '%s' does match requested type '%s'" %
-                           (self.type, request_type))
+                                 (self.type, request_type))
         return (OK, self.attributes)
 
     def update(self, request):
@@ -320,6 +330,7 @@
     def __str__(self):
         return super(PolicyEntity, self).__str__().replace("Entity(", "PolicyEntity(")
 
+
 class VhostEntity(EntityAdapter):
     def create(self):
         self._policy.create_ruleset(self.attributes)
@@ -346,7 +357,7 @@
 
 
 def _host_port_name_identifier(entity):
-    for attr in ['host', 'port', 'name']: # Set default values if need be
+    for attr in ['host', 'port', 'name']:  # Set default values if need be
         entity.attributes.setdefault(
             attr, entity.entity_type.attribute(attr).missing_value())
 
@@ -362,24 +373,28 @@
 
     def _delete(self):
         self._qd.qd_connection_manager_delete_ssl_profile(self._dispatch, self._implementations[0].key)
+
     def _identifier(self):
         return self.name
 
     def __str__(self):
         return super(SslProfileEntity, self).__str__().replace("Entity(", "SslProfileEntity(")
 
+
 class AuthServicePluginEntity(EntityAdapter):
     def create(self):
         return self._qd.qd_dispatch_configure_sasl_plugin(self._dispatch, self)
 
     def _delete(self):
         self._qd.qd_connection_manager_delete_sasl_plugin(self._dispatch, self._implementations[0].key)
+
     def _identifier(self):
         return self.name
 
     def __str__(self):
         return super(AuthServicePluginEntity, self).__str__().replace("Entity(", "AuthServicePluginEntity(")
 
+
 class ConnectionBaseEntity(EntityAdapter):
     """
     Provides validation of the openProperties attribute shared by Listener and
@@ -387,14 +402,14 @@
     """
     # qdrouterd reserves a set of connection-property keys as well as any key
     # that starts with certain prefixes
-    _RESERVED_KEYS=['product',
-                    'version',
-                    'failover-server-list',
-                    'network-host',
-                    'port',
-                    'scheme'
-                    'hostname']
-    _RESERVED_PREFIXES=['qd.', 'x-opt-qd.']
+    _RESERVED_KEYS = ['product',
+                      'version',
+                      'failover-server-list',
+                      'network-host',
+                      'port',
+                      'scheme'
+                      'hostname']
+    _RESERVED_PREFIXES = ['qd.', 'x-opt-qd.']
 
     def validate(self, **kwargs):
         super(ConnectionBaseEntity, self).validate(**kwargs)
@@ -419,7 +434,7 @@
             role = self.attributes.get('role', 'normal')
             if role in ['inter-router', 'edge']:
                 raise ValidationError("openProperties not allowed for role %s"
-                                      % role);
+                                      % role)
 
 
 class ListenerEntity(ConnectionBaseEntity):
@@ -459,6 +474,7 @@
     def __str__(self):
         return super(ConnectorEntity, self).__str__().replace("Entity(", "ConnectorEntity(")
 
+
 class AddressEntity(EntityAdapter):
     def create(self):
         self._qd.qd_dispatch_configure_address(self._dispatch, self)
@@ -466,6 +482,7 @@
     def __str__(self):
         return super(AddressEntity, self).__str__().replace("Entity(", "AddressEntity(")
 
+
 class LinkRouteEntity(EntityAdapter):
     def create(self):
         self._qd.qd_dispatch_configure_link_route(self._dispatch, self)
@@ -473,6 +490,7 @@
     def __str__(self):
         return super(LinkRouteEntity, self).__str__().replace("Entity(", "LinkRouteEntity(")
 
+
 class AutoLinkEntity(EntityAdapter):
     def create(self):
         self._qd.qd_dispatch_configure_auto_link(self._dispatch, self)
@@ -480,6 +498,7 @@
     def __str__(self):
         return super(AutoLinkEntity, self).__str__().replace("Entity(", "AutoLinkEntity(")
 
+
 class ConsoleEntity(EntityAdapter):
     def __str__(self):
         return super(ConsoleEntity, self).__str__().replace("Entity(", "ConsoleEntity(")
@@ -493,10 +512,10 @@
             for listener in listeners:
                 if listener.name == name:
                     try:
-                        #required
+                        # required
                         host   = listener.attributes['host']
                         port   = listener.attributes['port']
-                        #optional
+                        # optional
                         wsport = self.attributes.get('wsport')
                         home   = self.attributes.get('home')
                         args   = self.attributes.get('args')
@@ -510,16 +529,17 @@
                                 dargs['$wsport'] = wsport
                             if home:
                                 dargs['$home'] = home
-                            for k,v in dict_iteritems(dargs):
-                                args = args.replace(k,str(v))
+                            for k, v in dict_iteritems(dargs):
+                                args = args.replace(k, str(v))
                             pargs += args.split()
 
-                        #run the external program
+                        # run the external program
                         Popen(pargs)
                     except:
                         self._agent.log(LOG_ERROR, "Can't parse console entity: %s" % (format_exc()))
                     break
 
+
 class DummyEntity(EntityAdapter):
     def callme(self, request):
         return (OK, dict(**request.properties))
@@ -561,6 +581,7 @@
     def __str__(self):
         return super(AllocatorEntity, self).__str__().replace("Entity(", "AllocatorEntity(")
 
+
 class ExchangeEntity(EntityAdapter):
     def create(self):
         self._qd.qd_dispatch_configure_exchange(self._dispatch, self)
@@ -568,6 +589,7 @@
     def __str__(self):
         return super(ExchangeEntity, self).__str__().replace("Entity(", "ExchangeEntity(")
 
+
 class BindingEntity(EntityAdapter):
     def create(self):
         self._qd.qd_dispatch_configure_binding(self._dispatch, self)
@@ -575,6 +597,7 @@
     def __str__(self):
         return super(BindingEntity, self).__str__().replace("Entity(", "BindingEntity(")
 
+
 class HttpListenerEntity(EntityAdapter):
     def create(self):
         return self._qd.qd_dispatch_configure_http_listener(self._dispatch, self)
@@ -588,6 +611,7 @@
     def _delete(self):
         self._qd.qd_dispatch_delete_http_listener(self._dispatch, self._implementations[0].key)
 
+
 class TcpListenerEntity(EntityAdapter):
     def create(self):
         config_listener = self._qd.qd_dispatch_configure_tcp_listener(self._dispatch, self)
@@ -617,6 +641,7 @@
     def _delete(self):
         self._qd.qd_dispatch_delete_tcp_connector(self._dispatch, self._implementations[0].key)
 
+
 class HttpConnectorEntity(EntityAdapter):
     def create(self):
         return self._qd.qd_dispatch_configure_http_connector(self._dispatch, self)
@@ -647,14 +672,14 @@
     def map_filter(self, function, test):
         """Filter with test then apply function."""
         if function is None:
-            function = lambda x: x  # return results of filter
+            def function(x): return x  # return results of filter
         return list(map(function, filter(test, self.entities)))
 
     def map_type(self, function, type):
         """Apply function to all entities of type, if type is None do all
         entities"""
         if function is None:
-            function = lambda x: x
+            def function(x): return x
         if type is None:
             return list(map(function, self.entities))
         else:
@@ -662,6 +687,7 @@
                 type = self.schema.entity_type(type)
             return list(map(function, filter(lambda e: e.entity_type.is_a(type),
                                              self.entities)))
+
     def validate_add(self, entity):
         self.schema.validate_add(entity, self.entities)
 
@@ -691,7 +717,8 @@
             self.entities.remove(entity)
             self.log(LOG_DEBUG, "Remove %s entity: %s" %
                      (entity.entity_type.short_name, entity.attributes['identity']))
-        except ValueError: pass
+        except ValueError:
+            pass
 
     def remove(self, entity):
         self._remove(entity)
@@ -717,7 +744,7 @@
                 action, type, pointer = events[i]
                 if action == ADD:
                     add[pointer] = i
-                elif pointer in add: # action == REMOVE and there's an ADD
+                elif pointer in add:  # action == REMOVE and there's an ADD
                     redundant.append(add[pointer])
                     redundant.append(i)
                     del add[pointer]
@@ -736,11 +763,13 @@
                     entity_type = self.schema.entity_type(type)
                     self._add_implementation(CImplementation(self.qd, entity_type, pointer))
             # Refresh the entity values while the lock is still held.
-            for e in self.entities: e._refresh()
+            for e in self.entities:
+                e._refresh()
         finally:
             self.qd.qd_entity_refresh_end()
             self.qd.qd_dispatch_router_unlock(self.agent.dispatch)
 
+
 class ManagementEntity(EntityAdapter):
     """An entity representing the agent itself. It is a singleton created by the agent."""
 
@@ -751,8 +780,10 @@
 
     def requested_type(self, request):
         type = request.properties.get('entityType')
-        if type: return self._schema.entity_type(type)
-        else: return None
+        if type:
+            return self._schema.entity_type(type)
+        else:
+            return None
 
     def query(self, request):
         """Management node query operation"""
@@ -775,13 +806,16 @@
             names = all_attrs
 
         results = []
+
         def add_result(entity):
             result = []
             non_empty = False
             for name in names:
                 result.append(entity.attributes.get(name))
-                if result[-1] is not None: non_empty = True
-            if non_empty: results.append(result)
+                if result[-1] is not None:
+                    non_empty = True
+            if non_empty:
+                results.append(result)
 
         self._agent.entities.map_type(add_result, entity_type)
         return (OK, {'attributeNames': names, 'results': results})
@@ -812,6 +846,7 @@
     def get_mgmt_nodes(self, request):
         router = self._agent.entities.map_type(None, 'router')[0]
         area = router.attributes['area']
+
         def node_address(node):
             return str(Address.topological(node.attributes['id'], "$management", area))
         return (OK, self._agent.entities.map_type(node_address, 'router.node'))
@@ -821,7 +856,8 @@
 
     def _intprop(self, request, prop):
         value = request.properties.get(prop)
-        if value is not None: value = int(value)
+        if value is not None:
+            value = int(value)
         return value
 
     def get_json_schema(self, request):
@@ -849,19 +885,20 @@
             stats = pstats.Stats(profile, stream=out)
             try:
                 stop = request.properties["stop"]
-                if stop == "kgrind": # Generate kcachegrind output using pyprof2calltree
+                if stop == "kgrind":  # Generate kcachegrind output using pyprof2calltree
                     from pyprof2calltree import convert
                     convert(stats, out)
-                elif stop == "visualize": # Start kcachegrind using pyprof2calltree
+                elif stop == "visualize":  # Start kcachegrind using pyprof2calltree
                     from pyprof2calltree import visualize
                     visualize(stats)
                 else:
-                    stats.print_stats() # Plain python profile stats
+                    stats.print_stats()  # Plain python profile stats
                 return (OK, out.getvalue())
             finally:
                 out.close()
         raise BadRequestStatus("Bad profile request %s" % (request))
 
+
 class Agent(object):
     """AMQP managment agent. Manages entities, directs requests to the correct entity."""
 
@@ -877,7 +914,7 @@
         self.add_entity(self.management)
 
     def log(self, level, text):
-        info = traceback.extract_stack(limit=2)[0] # Caller frame info
+        info = traceback.extract_stack(limit=2)[0]  # Caller frame info
         self.log_adapter.log(level, text, info[0], info[1])
 
     def activate(self, address):
@@ -907,24 +944,25 @@
 
     def respond(self, request, status=OK, description=None, body=None):
         """Send a response to the client"""
-        if body is None: body = {}
+        if body is None:
+            body = {}
         description = description or STATUS_TEXT[status]
         response = Message(
             address=request.reply_to,
             correlation_id=request.correlation_id,
             properties={'statusCode': status, 'statusDescription': description},
             body=body)
-        self.log(LOG_DEBUG, "Agent response:\n  %s\n  Responding to: \n  %s"%(response, request))
+        self.log(LOG_DEBUG, "Agent response:\n  %s\n  Responding to: \n  %s" % (response, request))
         try:
             self.io.send(response)
         except:
-            self.log(LOG_ERROR, "Can't respond to %s: %s"%(request, format_exc()))
+            self.log(LOG_ERROR, "Can't respond to %s: %s" % (request, format_exc()))
 
     def receive(self, request, unused_link_id, unused_cost):
         """Called when a management request is received."""
         def error(e, trace):
             """Raise an error"""
-            self.log(LOG_ERROR, "Error performing %s: %s"%(request.properties.get('operation'), e.description))
+            self.log(LOG_ERROR, "Error performing %s: %s" % (request.properties.get('operation'), e.description))
             self.respond(request, e.status, e.description)
 
         # If there's no reply_to, don't bother to process the request.
@@ -935,7 +973,7 @@
         with self.request_lock:
             try:
                 self.entities.refresh_from_c()
-                self.log(LOG_DEBUG, "Agent request %s"% request)
+                self.log(LOG_DEBUG, "Agent request %s" % request)
                 status, body = self.handle(request)
                 self.respond(request, status=status, body=body)
             except ManagementError as e:
@@ -943,11 +981,13 @@
             except ValidationError as e:
                 error(BadRequestStatus(str(e)), format_exc())
             except Exception as e:
-                error(InternalServerErrorStatus("%s: %s"%(type(e).__name__, e)), format_exc())
+                error(InternalServerErrorStatus("%s: %s" % (type(e).__name__, e)), format_exc())
 
     def entity_type(self, type):
-        try: return self.schema.entity_type(type)
-        except ValidationError as e: raise NotFoundStatus(str(e))
+        try:
+            return self.schema.entity_type(type)
+        except ValidationError as e:
+            raise NotFoundStatus(str(e))
 
     def handle(self, request):
         """
@@ -1055,7 +1095,7 @@
             """String form of the id attribute values for error messages"""
             return " ".join(["%s=%s" % (k, v) for k, v in dict_iteritems(ids)])
 
-        k, v = next(dict_iteritems(ids)) # Get the first id attribute
+        k, v = next(dict_iteritems(ids))  # Get the first id attribute
         found = self.entities.map_filter(None, lambda e: e.attributes.get(k) == v)
         if len(found) == 1:
             entity = found[0]
@@ -1066,7 +1106,8 @@
             raise NotFoundStatus("No entity with %s" % attrvals())
 
         for k, v in dict_iteritems(ids):
-            if entity[k] != v: raise BadRequestStatus("Conflicting %s" % attrvals())
+            if entity[k] != v:
+                raise BadRequestStatus("Conflicting %s" % attrvals())
 
         if requested_type:
             if not entity.entity_type.is_a(requested_type):
diff --git a/python/qpid_dispatch_internal/management/config.py b/python/qpid_dispatch_internal/management/config.py
index fe38fc0..93e3a9e 100644
--- a/python/qpid_dispatch_internal/management/config.py
+++ b/python/qpid_dispatch_internal/management/config.py
@@ -26,7 +26,9 @@
 from __future__ import print_function
 
 
-import json, re, sys
+import json
+import re
+import sys
 import os
 import traceback
 from copy import copy
@@ -67,7 +69,7 @@
 
     def _log(self, level, text):
         if self._log_adapter is not None:
-            info = traceback.extract_stack(limit=2)[0] # Caller frame info
+            info = traceback.extract_stack(limit=2)[0]  # Caller frame info
             self._log_adapter.log(level, text, info[0], info[1])
 
     @staticmethod
@@ -75,11 +77,16 @@
         for s in sections:
             s[0] = camelcase(s[0])
             s[1] = dict((camelcase(k), v) for k, v in dict_iteritems(s[1]))
-            if s[0] == "address":   s[0] = "router.config.address"
-            if s[0] == "linkRoute": s[0] = "router.config.linkRoute"
-            if s[0] == "autoLink":  s[0] = "router.config.autoLink"
-            if s[0] == "exchange":  s[0] = "router.config.exchange"
-            if s[0] == "binding":   s[0] = "router.config.binding"
+            if s[0] == "address":
+                s[0] = "router.config.address"
+            if s[0] == "linkRoute":
+                s[0] = "router.config.linkRoute"
+            if s[0] == "autoLink":
+                s[0] = "router.config.autoLink"
+            if s[0] == "exchange":
+                s[0] = "router.config.exchange"
+            if s[0] == "binding":
+                s[0] = "router.config.binding"
 
     def _parse(self, lines):
         """
@@ -192,11 +199,11 @@
             self._line_num += 1
             return line
 
-        js_text = "[%s]"%("\n".join([sub(l) for l in lines]))
+        js_text = "[%s]" % ("\n".join([sub(l) for l in lines]))
         if self._in_json or self._child_level != 0:
             self._log(LOG_WARNING,
                       "Configuration file: invalid entity nesting detected.")
-        spare_comma = re.compile(r',\s*([]}])') # Strip spare commas
+        spare_comma = re.compile(r',\s*([]}])')  # Strip spare commas
         js_text = re.sub(spare_comma, r'\1', js_text)
         # Convert dictionary keys to camelCase
         try:
@@ -213,7 +220,7 @@
             # ignore comment lines that start with "[whitespace] #"
             line = "" if line.strip().startswith('#') else line
             return line
-        js_text = "%s"%("\n".join([sub(l) for l in lines]))
+        js_text = "%s" % ("\n".join([sub(l) for l in lines]))
         try:
             sections = json.loads(js_text)
         except Exception as e:
@@ -265,6 +272,7 @@
         for idx in range(len(lines)):
             self._log(LOG_ERROR, "Line %d |%s" % (idx + 1, lines[idx]))
 
+
 class PolicyConfig(Config):
     def __init__(self, filename=None, schema=QdSchema(), raw_json=False):
         super(PolicyConfig, self).__init__(filename, schema, raw_json)
@@ -272,6 +280,7 @@
     def get_config_types(self):
         return [s for s in self.config_types if 'policy' in s.name]
 
+
 def configure_dispatch(dispatch, lib_handle, filename):
     """Called by C router code to load configuration file and do configuration"""
     qd = QdDll(lib_handle)
diff --git a/python/qpid_dispatch_internal/management/qdrouter.py b/python/qpid_dispatch_internal/management/qdrouter.py
index 610e6f4..70941e1 100644
--- a/python/qpid_dispatch_internal/management/qdrouter.py
+++ b/python/qpid_dispatch_internal/management/qdrouter.py
@@ -30,6 +30,7 @@
 from . import schema
 from qpid_dispatch_internal.compat import JSON_LOAD_KWARGS
 
+
 class QdSchema(schema.Schema):
     """
     Qpid Dispatch Router management schema.
@@ -53,7 +54,7 @@
         Check that listeners and connectors can only have role=inter-router if the router has
         mode=interior.
         """
-        entities = list(entities) # Iterate twice
+        entities = list(entities)  # Iterate twice
         super(QdSchema, self).validate_add(attributes, entities)
         entities.append(attributes)
         router_mode = listener_connector_role = listener_role = None
diff --git a/python/qpid_dispatch_internal/management/schema.py b/python/qpid_dispatch_internal/management/schema.py
index 6c52a34..e82df70 100644
--- a/python/qpid_dispatch_internal/management/schema.py
+++ b/python/qpid_dispatch_internal/management/schema.py
@@ -49,16 +49,19 @@
     # LogAdapter is not loaded. When running the router, the LogAdapter is available.
     logger_available = False
 
+
 class ValidationError(Exception):
     """Error raised if schema validation fails"""
     pass
 
+
 class Type(object):
     """Base class for schema types.
 
     @ivar name: The type name.
     @ivar pytype: The python type for this schema type.
     """
+
     def __init__(self, name, pytype):
         """
         @param name: The type name.
@@ -90,7 +93,7 @@
     def __init__(self):
         super(BooleanType, self).__init__("boolean", bool)
 
-    VALUES = {"yes":1, "true":1, "on":1, "no":0, "false":0, "off":0}
+    VALUES = {"yes": 1, "true": 1, "on": 1, "no": 0, "false": 0, "off": 0}
 
     def validate(self, value):
         """
@@ -103,7 +106,7 @@
                 return self.VALUES[value.lower()]
             return bool(value)
         except:
-            raise ValidationError("Invalid Boolean value '%r'"%value)
+            raise ValidationError("Invalid Boolean value '%r'" % value)
 
 
 class EnumValue(str):
@@ -119,7 +122,7 @@
     def __long__(self): return self.value
     def __eq__(self, x): return str(self) == x or int(self) == x
     def __ne__(self, x): return not self == x
-    def __repr__(self): return "EnumValue('%s', %s)"%(str(self), int(self))
+    def __repr__(self): return "EnumValue('%s', %s)" % (str(self), int(self))
 
 
 class EnumType(Type):
@@ -130,7 +133,7 @@
         @param tags: A list of string values for the enumerated type.
         """
         assert isinstance(tags, list)
-        super(EnumType, self).__init__("enum%s"%([str(t) for t in tags]), int)
+        super(EnumType, self).__init__("enum%s" % ([str(t) for t in tags]), int)
         self.tags = tags
 
     def validate(self, value):
@@ -147,7 +150,7 @@
                 return EnumValue(self.tags[i], i)
             except (ValueError, IndexError):
                 pass
-        raise ValidationError("Invalid value for %s: %r"%(self.name, value))
+        raise ValidationError("Invalid value for %s: %r" % (self.name, value))
 
     def dump(self):
         """
@@ -157,7 +160,7 @@
 
     def __str__(self):
         """String description of enum type."""
-        return "One of [%s]" % ', '.join([("'%s'" %tag) for tag in self.tags])
+        return "One of [%s]" % ', '.join([("'%s'" % tag) for tag in self.tags])
 
 
 class PropertiesType(Type):
@@ -166,16 +169,17 @@
     See the "fields" type in:
     http://docs.oasis-open.org/amqp/core/v1.0/os/amqp-core-transport-v1.0-os.html#type-fields
     """
+
     def __init__(self):
         super(PropertiesType, self).__init__("properties", dict)
 
     def validate(self, value):
         if not isinstance(value, dict):
-            raise ValidationError("Properties must be a map");
+            raise ValidationError("Properties must be a map")
 
         for key in value.keys():
             if (not isinstance(key, PY_STRING_TYPE)
-                or any(ord(x) > 127 for x in key)):
+                    or any(ord(x) > 127 for x in key)):
                 raise ValidationError("Property keys must be ASCII encoded")
         return value
 
@@ -191,6 +195,7 @@
                           PropertiesType(),
                           BooleanType()])
 
+
 def get_type(rep):
     """
     Get a schema type.
@@ -202,6 +207,7 @@
         return BUILTIN_TYPES[rep]
     raise ValidationError("No such schema type: %s" % rep)
 
+
 def _dump_dict(items):
     """
     Remove all items with None value from a mapping.
@@ -209,6 +215,7 @@
     """
     return OrderedDict((k, v) for k, v in items if v)
 
+
 class AttributeType(object):
     """
     Definition of an attribute.
@@ -248,9 +255,9 @@
             if self.value is not None and self.default is not None:
                 raise ValidationError("Attribute '%s' has default value and fixed value" %
                                       self.name)
-            self.create=create
-            self.update=update
-            self.graph=graph
+            self.create = create
+            self.update = update
+            self.graph = graph
         except Exception:
             raise ValidationError("Attribute '%s': %s\n%s"
                                   % (name,
@@ -275,7 +282,7 @@
         @return: value converted to the correct python type. Rais exception if any check fails.
         """
         if self.value and value != self.value:
-            raise ValidationError("Attribute '%s' has fixed value '%s' but given '%s'"%(
+            raise ValidationError("Attribute '%s' has fixed value '%s' but given '%s'" % (
                 self.name, self.value, value))
         try:
             return self.atype.validate(value)
@@ -302,22 +309,27 @@
 
 class MessageDef(object):
     """A request or response message"""
+
     def __init__(self, body=None, properties=None):
         self.body = None
-        if body: self.body = AttributeType("body", **body)
+        if body:
+            self.body = AttributeType("body", **body)
         self.properties = dict((name, AttributeType(name, **value))
                                for name, value in (properties or {}).items())
 
 
 class OperationDef(object):
     """An operation definition"""
+
     def __init__(self, name, description=None, request=None, response=None):
         try:
             self.name = name
             self.description = description
             self.request = self.response = None
-            if request: self.request = MessageDef(**request)
-            if response: self.response = MessageDef(**response)
+            if request:
+                self.request = MessageDef(**request)
+            if response:
+                self.response = MessageDef(**response)
         except Exception as exc:
             raise ValidationError("Operation '%s': %s\n%s"
                                   % (name, str(exc), sys.exc_info()[2]))
@@ -333,6 +345,7 @@
     @ivar singleton: If true only one entity of this type is allowed.
     @ivar referential: True if an entity can be referred to by name from another entity.
     """
+
     def __init__(self, name, schema, attributes=None, operations=None, operationDefs=None,
                  description="", fullName=True, singleton=False, deprecated=False,
                  extends=None, referential=False):
@@ -356,7 +369,7 @@
             else:
                 self.name = self.short_name = name
             self.attributes = OrderedDict((k, AttributeType(k, defined_in=self, **v))
-                                              for k, v in (attributes or {}).items())
+                                          for k, v in (attributes or {}).items())
 
             self.deprecated_attributes = OrderedDict()
             for key, value in self.attributes.items():
@@ -393,7 +406,7 @@
             self._init = False      # Have not yet initialized from base and attributes.
             # Operation definitions
             self.operation_defs = dict((name, OperationDef(name, **op))
-                                  for name, op in (operationDefs or {}).items())
+                                       for name, op in (operationDefs or {}).items())
         except Exception as exc:
             raise ValidationError("%s '%s': %s\n%s" % (type(self).__name__,
                                                        name,
@@ -402,7 +415,8 @@
 
     def init(self):
         """Find bases after all types are loaded."""
-        if self._init: return
+        if self._init:
+            return
         self._init = True
         if self.base:
             self.base = self.schema.entity_type(self.base)
@@ -431,7 +445,7 @@
 
     def attribute(self, name):
         """Get the AttributeType for name"""
-        if not name in self.attributes and not name in dict_keys(self.deprecated_attributes):
+        if name not in self.attributes and name not in dict_keys(self.deprecated_attributes):
             raise ValidationError("Unknown attribute '%s' for '%s'" % (name, self))
         if self.attributes.get(name):
             return self.attributes[name]
@@ -453,7 +467,8 @@
         @param attributes: Map attributes name:value or Entity with attributes property.
             Modifies attributes: adds defaults, converts values.
         """
-        if isinstance(attributes, SchemaEntity): attributes = attributes.attributes
+        if isinstance(attributes, SchemaEntity):
+            attributes = attributes.attributes
 
         try:
             # Add missing values
@@ -466,7 +481,7 @@
                         if value is not None:
                             if logger_available:
                                 self.log(LOG_WARNING, "Attribute '%s' of entity '%s' has been deprecated."
-                                                      " Use '%s' instead"%(deprecation_name, self.short_name, attr.name))
+                                                      " Use '%s' instead" % (deprecation_name, self.short_name, attr.name))
                             del attributes[deprecation_name]
 
                     if value is None:
@@ -479,7 +494,7 @@
                     deprecation_name = attr.deprecation_name
                     if deprecation_name:
                         value = attributes.get(deprecation_name)
-                        if not value is None:
+                        if value is not None:
                             # Both name and deprecation name have values
                             # For example, both dir and direction of linkRoute have been specified, This is
                             # illegal. Just fail.
@@ -499,7 +514,7 @@
     def allowed(self, op, body):
         """Raise exception if op is not a valid operation on entity."""
         op = op.upper()
-        if not op in self.operations:
+        if op not in self.operations:
             raise NotImplementedStatus("Operation '%s' not implemented for '%s' %s" % (
                 op, self.name, self.operations))
 
@@ -520,7 +535,7 @@
         return _dump_dict([
             ('attributes', OrderedDict(
                 (k, v.dump()) for k, v in self.attributes.items()
-                if k != 'type')), # Don't dump 'type' attribute, dumped separately.
+                if k != 'type')),  # Don't dump 'type' attribute, dumped separately.
             ('operations', self.operations),
             ('description', self.description or None),
             ('fullyQualifiedType', self.name or None),
@@ -537,7 +552,6 @@
         return self.name == self.schema.long_name(name)
 
 
-
 class Schema(object):
     """
     Schema defining entity types.
@@ -547,6 +561,7 @@
     @ivar entityTypes: Map of L{EntityType} by name.
     @ivar description: Text description of schema.
     """
+
     def __init__(self, prefix="", entityTypes=None, description=""):
         """
         @param prefix: Prefix for entity names.
@@ -580,19 +595,21 @@
     def log(self, level, text):
         if not self.log_adapter:
             return
-        info = traceback.extract_stack(limit=2)[0] # Caller frame info
+        info = traceback.extract_stack(limit=2)[0]  # Caller frame info
         self.log_adapter.log(level, text, info[0], info[1])
 
     def short_name(self, name):
         """Remove prefix from name if present"""
-        if not name: return name
+        if not name:
+            return name
         if name.startswith(self.prefixdot):
             name = name[len(self.prefixdot):]
         return name
 
     def long_name(self, name):
         """Add prefix to unqualified name"""
-        if not name: return name
+        if not name:
+            return name
         if not name.startswith(self.prefixdot):
             name = self.prefixdot + name
         return name
@@ -631,7 +648,7 @@
         entities = []
         for a in attribute_maps:
             self.validate_add(a, entities)
-            entities.append(a);
+            entities.append(a)
 
     def validate_add(self, attributes, entities):
         """
@@ -653,7 +670,7 @@
                 try:
                     if entity_type.attributes[a.name] == a and attributes[a.name] == e[a.name]:
                         raise ValidationError(
-                            "adding %s duplicates unique attribute '%s' from existing %s"%
+                            "adding %s duplicates unique attribute '%s' from existing %s" %
                             (attributes, a.name, e))
                 except KeyError:
                     continue    # Missing attribute or definition means no clash
@@ -669,7 +686,8 @@
 
     def filter(self, predicate):
         """Return an iterator over entity types that satisfy predicate."""
-        if predicate is None: return self.entity_types.values()
+        if predicate is None:
+            return self.entity_types.values()
         return (t for t in self.entity_types.values() if predicate(t))
 
     def by_type(self, type):
@@ -680,13 +698,16 @@
         else:
             return self.filter(lambda t: t.is_a(type))
 
+
 class SchemaEntity(EntityBase):
     """A map of attributes associated with an L{EntityType}"""
+
     def __init__(self, entity_type, attributes=None, validate=True, **kwattrs):
         super(SchemaEntity, self).__init__(attributes, **kwattrs)
         self.__dict__['entity_type'] = entity_type
         self.attributes.setdefault('type', entity_type.name)
-        if validate: self.validate()
+        if validate:
+            self.validate()
 
     def _set(self, name, value):
         super(SchemaEntity, self)._set(name, value)
diff --git a/python/qpid_dispatch_internal/management/schema_doc.py b/python/qpid_dispatch_internal/management/schema_doc.py
index 56cb929..f3bbaee 100644
--- a/python/qpid_dispatch_internal/management/schema_doc.py
+++ b/python/qpid_dispatch_internal/management/schema_doc.py
@@ -29,6 +29,7 @@
 from .schema import AttributeType
 from qpid_dispatch_internal.compat import PY_STRING_TYPE, dict_itervalues
 
+
 class SchemaWriter(object):
     """Write the schema as an asciidoc document"""
 
@@ -38,17 +39,19 @@
         # Options affecting how output is written
 
     def warn(self, message):
-        if not self.quiet: print(message, file=sys.stderr)
+        if not self.quiet:
+            print(message, file=sys.stderr)
 
     def write(self, text): self.output.write(text)
 
-    def writeln(self, text=""): self.output.write(text+"\n")
+    def writeln(self, text=""): self.output.write(text + "\n")
 
-    def para(self, text): self.write(text+"\n\n")
+    def para(self, text): self.write(text + "\n\n")
 
     def heading(self, text=None, sub=0):
         self._heading += sub
-        if text: self.para("\n=%s %s" % ("="*self._heading, text))
+        if text:
+            self.para("\n=%s %s" % ("=" * self._heading, text))
 
     class Section(namedtuple("Section", ["writer", "heading"])):
         def __enter__(self): self.writer.heading(self.heading, sub=+1)
@@ -67,7 +70,7 @@
                           attr.unique and "unique",
                           show_create and attr.create and "`CREATE`",
                           show_update and attr.update and "`UPDATE`"
-                      ])))
+                          ])))
 
     def attribute_type(self, attr, holder=None, show_create=True, show_update=True):
         self.writeln("'%s'%s::" % (
@@ -110,7 +113,8 @@
                         self.attribute_type(prop)
 
         with self.section("Operation %s" % op.name):
-            if op.description: self.para(op.description)
+            if op.description:
+                self.para(op.description)
             request_response("request")
             request_response("response")
 
@@ -135,4 +139,3 @@
         base = self.schema.entity_type(base_name)
         for entity_type in self.schema.filter(lambda t: t.extends(base)):
             self.entity_type(entity_type)
-
diff --git a/python/qpid_dispatch_internal/policy/__init__.py b/python/qpid_dispatch_internal/policy/__init__.py
index 6417447..a511539 100644
--- a/python/qpid_dispatch_internal/policy/__init__.py
+++ b/python/qpid_dispatch_internal/policy/__init__.py
@@ -17,4 +17,3 @@
 # under the License.
 #
 """Qpid Dispatch internal policy package."""
-
diff --git a/python/qpid_dispatch_internal/policy/policy_local.py b/python/qpid_dispatch_internal/policy/policy_local.py
index b75163e..9a47c76 100644
--- a/python/qpid_dispatch_internal/policy/policy_local.py
+++ b/python/qpid_dispatch_internal/policy/policy_local.py
@@ -41,6 +41,8 @@
 
 #
 #
+
+
 class PolicyKeys(object):
     """
     String constants
@@ -118,6 +120,8 @@
 
 #
 #
+
+
 class PolicyCompiler(object):
     """
     Validate incoming configuration for legal schema.
@@ -139,7 +143,7 @@
         PolicyKeys.KW_CONNECTION_ALLOW_DEFAULT,
         PolicyKeys.KW_GROUPS,
         PolicyKeys.KW_VHOST_ALIASES
-        ]
+    ]
 
     allowed_settings_options = [
         PolicyKeys.KW_USERS,
@@ -163,7 +167,7 @@
         PolicyKeys.KW_TARGETS,
         PolicyKeys.KW_SOURCE_PATTERN,
         PolicyKeys.KW_TARGET_PATTERN
-        ]
+    ]
 
     def __init__(self):
         """
@@ -171,7 +175,6 @@
         """
         pass
 
-
     def validateNumber(self, val, v_min, v_max, errors):
         """
         Range check a numeric int policy value
@@ -194,7 +197,6 @@
             return False
         return True
 
-
     def compile_connection_group(self, vhostname, groupname, val, list_out, warnings, errors):
         """
         Handle an ingressHostGroups submap.
@@ -229,11 +231,10 @@
                 list_out.append(coha)
             except Exception as e:
                 errors.append("Policy vhost '%s' user group '%s' option '%s' connectionOption '%s' failed to translate: '%s'." %
-                                (vhostname, groupname, key, coname, e))
+                              (vhostname, groupname, key, coname, e))
                 return False
         return True
 
-
     def compile_app_settings(self, vhostname, usergroup, policy_in, policy_out, warnings, errors):
         """
         Compile a vhostUserGroupSettings schema from processed json format to local internal format.
@@ -268,7 +269,7 @@
         policy_out[PolicyKeys.KW_TARGETS] = ''
         policy_out[PolicyKeys.KW_SOURCE_PATTERN] = ''
         policy_out[PolicyKeys.KW_TARGET_PATTERN] = ''
-        policy_out[PolicyKeys.KW_MAXCONNPERHOST] = None # optional group limit
+        policy_out[PolicyKeys.KW_MAXCONNPERHOST] = None  # optional group limit
         policy_out[PolicyKeys.KW_MAXCONNPERUSER] = None
 
         cerror = []
@@ -284,18 +285,18 @@
                        PolicyKeys.KW_MAXCONNPERUSER
                        ]:
                 if not self.validateNumber(val, 0, 65535, cerror):
-                    msg = ("Policy vhost '%s' user group '%s' option '%s' has error '%s'." % 
+                    msg = ("Policy vhost '%s' user group '%s' option '%s' has error '%s'." %
                            (vhostname, usergroup, key, cerror[0]))
                     errors.append(msg)
                     return False
                 policy_out[key] = int(val)
             elif key in [PolicyKeys.KW_MAX_FRAME_SIZE,
-                       PolicyKeys.KW_MAX_MESSAGE_SIZE,
-                       PolicyKeys.KW_MAX_RECEIVERS,
-                       PolicyKeys.KW_MAX_SENDERS,
-                       PolicyKeys.KW_MAX_SESSION_WINDOW,
-                       PolicyKeys.KW_MAX_SESSIONS
-                       ]:
+                         PolicyKeys.KW_MAX_MESSAGE_SIZE,
+                         PolicyKeys.KW_MAX_RECEIVERS,
+                         PolicyKeys.KW_MAX_SENDERS,
+                         PolicyKeys.KW_MAX_SESSION_WINDOW,
+                         PolicyKeys.KW_MAX_SESSIONS
+                         ]:
                 if not self.validateNumber(val, 0, 0, cerror):
                     errors.append("Policy vhost '%s' user group '%s' option '%s' has error '%s'." %
                                   (vhostname, usergroup, key, cerror[0]))
@@ -378,7 +379,7 @@
                                 if key in [PolicyKeys.KW_SOURCE_PATTERN,
                                            PolicyKeys.KW_TARGET_PATTERN]:
                                     errors.append("Policy vhost '%s' user group '%s' policy key '%s' item '%s' may contain match pattern '%s' as a prefix or a suffix only." %
-                                          (vhostname, usergroup, key, v, utoken))
+                                                  (vhostname, usergroup, key, v, utoken))
                                     return False
                                 eVal.append(PolicyKeys.KC_TUPLE_EMBED)
                                 eVal.append(v[0:v.find(utoken)])
@@ -413,7 +414,6 @@
 
         return True
 
-
     def compile_access_ruleset(self, name, policy_in, policy_out, warnings, errors):
         """
         Compile a vhost schema from processed json format to local internal format.
@@ -447,13 +447,13 @@
                        PolicyKeys.KW_MAXCONNPERUSER
                        ]:
                 if not self.validateNumber(val, 0, 65535, cerror):
-                    msg = ("Policy vhost '%s' option '%s' has error '%s'." % 
+                    msg = ("Policy vhost '%s' option '%s' has error '%s'." %
                            (name, key, cerror[0]))
                     errors.append(msg)
                     return False
                 policy_out[key] = val
             elif key in [PolicyKeys.KW_MAX_MESSAGE_SIZE
-                       ]:
+                         ]:
                 if not self.validateNumber(val, 0, 0, cerror):
                     msg = ("Policy vhost '%s' option '%s' has error '%s'." %
                            (name, key, cerror[0]))
@@ -513,7 +513,7 @@
 
         # Default connections require a default settings
         if policy_out[PolicyKeys.KW_CONNECTION_ALLOW_DEFAULT]:
-            if not PolicyKeys.KW_DEFAULT_SETTINGS in policy_out[PolicyKeys.KW_GROUPS]:
+            if PolicyKeys.KW_DEFAULT_SETTINGS not in policy_out[PolicyKeys.KW_GROUPS]:
                 errors.append("Policy vhost '%s' allows connections by default but default settings are not defined" %
                               (name))
                 return False
@@ -527,13 +527,14 @@
     """
     Maintain live state and statistics for an vhost.
     """
+
     def __init__(self, id, manager, ruleset):
         self.my_id = id
         self._manager = manager
         self.conn_mgr = PolicyAppConnectionMgr(
-                ruleset[PolicyKeys.KW_MAXCONN],
-                ruleset[PolicyKeys.KW_MAXCONNPERUSER],
-                ruleset[PolicyKeys.KW_MAXCONNPERHOST])
+            ruleset[PolicyKeys.KW_MAXCONN],
+            ruleset[PolicyKeys.KW_MAXCONNPERUSER],
+            ruleset[PolicyKeys.KW_MAXCONNPERHOST])
         self._cstats = self._manager.get_agent().qd.qd_dispatch_policy_c_counts_alloc()
         self._manager.get_agent().add_implementation(self, "vhostStats")
 
@@ -576,6 +577,8 @@
 
 #
 #
+
+
 class ConnectionFacts(object):
     def __init__(self, user, host, app, conn_name):
         self.user = user
@@ -585,6 +588,8 @@
 
 #
 #
+
+
 class PolicyLocal(object):
     """
     The local policy database.
@@ -651,6 +656,7 @@
     #
     # Service interfaces
     #
+
     def create_ruleset(self, attributes):
         """
         Create or update named policy ruleset.
@@ -914,16 +920,16 @@
 
             if vhost not in self.rulesetdb:
                 self._manager.log_info(
-                        "lookup_settings fail for vhost '%s', user group '%s': "
-                        "No policy defined for this vhost" % (vhost, groupname))
+                    "lookup_settings fail for vhost '%s', user group '%s': "
+                    "No policy defined for this vhost" % (vhost, groupname))
                 return False
 
             ruleset = self.rulesetdb[vhost]
 
             if groupname not in ruleset[PolicyKeys.KW_GROUPS]:
                 self._manager.log_trace(
-                        "lookup_settings fail for vhost '%s', user group '%s': "
-                        "This vhost has no settings for the user group" % (vhost, groupname))
+                    "lookup_settings fail for vhost '%s', user group '%s': "
+                    "This vhost has no settings for the user group" % (vhost, groupname))
                 return False
 
             upolicy.update(ruleset[PolicyKeys.KW_GROUPS][groupname])
diff --git a/python/qpid_dispatch_internal/policy/policy_manager.py b/python/qpid_dispatch_internal/policy/policy_manager.py
index b44239b..79a40bb 100644
--- a/python/qpid_dispatch_internal/policy/policy_manager.py
+++ b/python/qpid_dispatch_internal/policy/policy_manager.py
@@ -33,11 +33,11 @@
 from ..dispatch import LogAdapter, LOG_INFO, LOG_TRACE, LOG_DEBUG, LOG_ERROR, LOG_WARNING
 
 
-
 """
 Entity implementing the glue between the policy engine and the rest of the system.
 """
 
+
 class PolicyManager(object):
     """
 
@@ -52,11 +52,11 @@
         self._use_hostname_patterns = False
 
     def log(self, level, text):
-        info = traceback.extract_stack(limit=2)[0] # Caller frame info
+        info = traceback.extract_stack(limit=2)[0]  # Caller frame info
         self.log_adapter.log(level, text, info[0], info[1])
 
     def _log(self, level, text):
-        info = traceback.extract_stack(limit=3)[0] # Caller's caller frame info
+        info = traceback.extract_stack(limit=3)[0]  # Caller's caller frame info
         self.log_adapter.log(level, text, info[0], info[1])
 
     def log_debug(self, text):
@@ -184,6 +184,8 @@
 #
 #
 #
+
+
 def policy_lookup_vhost_alias(mgr, vhost):
     """
     Look up a vhost in the policy database
@@ -197,6 +199,8 @@
 #
 #
 #
+
+
 def policy_lookup_user(mgr, user, rhost, vhost, conn_name, conn_id):
     """
     Look up a user in the policy database
@@ -213,6 +217,8 @@
 #
 #
 #
+
+
 def policy_close_connection(mgr, conn_id):
     """
     Close the connection.
@@ -226,6 +232,8 @@
 #
 #
 #
+
+
 def policy_lookup_settings(mgr, vhost, name, upolicy):
     """
     Return settings for <vhost, usergroup> in upolicy map
diff --git a/python/qpid_dispatch_internal/policy/policy_util.py b/python/qpid_dispatch_internal/policy/policy_util.py
index 00a0426..57fdc67 100644
--- a/python/qpid_dispatch_internal/policy/policy_util.py
+++ b/python/qpid_dispatch_internal/policy/policy_util.py
@@ -27,12 +27,16 @@
 
 #
 #
+
+
 class PolicyError(Exception):
     def __init__(self, value):
         self.value = value
+
     def __str__(self):
         return str(self.value)
 
+
 def is_ipv6_enabled():
     """
     Returns true if IPV6 is enabled, false otherwise
@@ -47,6 +51,7 @@
 
     return ipv6_enabled
 
+
 class HostStruct(object):
     """
     HostStruct represents a single, binary socket address from getaddrinfo
@@ -61,7 +66,6 @@
         families.append(socket.AF_INET6)
         famnames.append("IPv6")
 
-
     def __init__(self, hostname):
         """
         Given a host name text string, return the socket info for it.
@@ -88,7 +92,7 @@
                                               hostname)
             if not foundFirst:
                 raise PolicyError("HostStruct: '%s' did not resolve to one of the supported address family" %
-                        hostname)
+                                  hostname)
             self.name = hostname
             self.saddr = saddr
             self.family = sfamily
@@ -113,6 +117,8 @@
 
 #
 #
+
+
 class HostAddr(object):
     """
     Provide HostIP address ranges and comparison functions.
@@ -179,10 +185,10 @@
 
     def memcmp(self, a, b):
         res = 0
-        for i in range(0,len(a)):
+        for i in range(0, len(a)):
             if a[i] > b[i]:
                 res = 1
-                break;
+                break
             elif a[i] < b[i]:
                 res = -1
                 break
@@ -226,6 +232,8 @@
 
 #
 #
+
+
 class PolicyAppConnectionMgr(object):
     """
     Track policy user/host connection limits and statistics for one app.
@@ -243,6 +251,7 @@
     per_user_state : { 'user1' : [conn1, conn2, conn3],
                        'user2' : [conn4, conn5] }
     """
+
     def __init__(self, maxconn, maxconnperuser, maxconnperhost):
         """
         The object is constructed with the policy limits and zeroed counts.
@@ -263,7 +272,7 @@
 
     def __str__(self):
         res = ("Connection Limits: total: %s, per user: %s, per host: %s\n" %
-            (self.max_total, self.max_per_user, self.max_per_host))
+               (self.max_total, self.max_per_user, self.max_per_host))
         res += ("Connections Statistics: total approved: %s, total denied: %s" %
                 (self.connections_approved, self.connections_denied))
         res += ("Connection State: total current: %s" % self.connections_active)
@@ -313,10 +322,10 @@
         allowbyhost  = n_host < max_per_host
 
         if allowbytotal and allowbyuser and allowbyhost:
-            if not user in self.per_user_state:
+            if user not in self.per_user_state:
                 self.per_user_state[user] = []
             self.per_user_state[user].append(conn_id)
-            if not host in self.per_host_state:
+            if host not in self.per_host_state:
                 self.per_host_state[host] = []
             self.per_host_state[host].append(conn_id)
             self.connections_active += 1
@@ -344,7 +353,6 @@
         self.per_user_state[user].remove(conn_id)
         self.per_host_state[host].remove(conn_id)
 
-
     def count_other_denial(self):
         """
         Record the statistic for a connection denied by some other process
diff --git a/python/qpid_dispatch_internal/router/address.py b/python/qpid_dispatch_internal/router/address.py
index 24cb6a4..c669a73 100644
--- a/python/qpid_dispatch_internal/router/address.py
+++ b/python/qpid_dispatch_internal/router/address.py
@@ -24,18 +24,21 @@
 from __future__ import absolute_import
 from __future__ import print_function
 
+
 class Address(str):
     """A router address. Immutable, hashable.
     Subclasses str, so inherits all hash, comparison etc. properties.
     Provides a central place for logic to construct addresses of various types.
     """
 
-    AMQP="amqp:"
-    TOPO="_topo"
+    AMQP = "amqp:"
+    TOPO = "_topo"
 
-    def __new__(self, addr): # Subclassing immutable type, must use __new__ not __init__
-        if addr.startswith(self.AMQP): return str.__new__(addr)
-        else: return str.__new__(Address, "%s/%s" % (self.AMQP, addr))
+    def __new__(self, addr):  # Subclassing immutable type, must use __new__ not __init__
+        if addr.startswith(self.AMQP):
+            return str.__new__(addr)
+        else:
+            return str.__new__(Address, "%s/%s" % (self.AMQP, addr))
 
     @classmethod
     def mobile(cls, path):
@@ -52,7 +55,8 @@
         @param area: Routing area (placeholder)
         """
         addr = "%s/%s/%s" % (cls.TOPO, area, router_id)
-        if path: addr = "%s/%s" % (addr, path)
+        if path:
+            addr = "%s/%s" % (addr, path)
         return Address(addr)
 
     def __repr__(self): return "Address(%r)" % str(self)
diff --git a/python/qpid_dispatch_internal/router/data.py b/python/qpid_dispatch_internal/router/data.py
index d22d519..18b3a7b 100644
--- a/python/qpid_dispatch_internal/router/data.py
+++ b/python/qpid_dispatch_internal/router/data.py
@@ -18,8 +18,8 @@
 #
 
 ##
-## Define the current protocol version.  Any messages that do not contain version
-## information shall be considered to be coming from routers using version 0.
+# Define the current protocol version.  Any messages that do not contain version
+# information shall be considered to be coming from routers using version 0.
 ##
 
 from __future__ import unicode_literals
@@ -33,6 +33,7 @@
 
 ProtocolVersion = LONG(1)
 
+
 def getMandatory(data, key, cls=None):
     """
     Get the value mapped to the requested key.    If it's not present, raise an exception.
@@ -87,6 +88,7 @@
     The link-state of a single router.  The link state consists of a list of neighbor routers reachable from
     the reporting router.  The link-state-sequence number is incremented each time the link state changes.
     """
+
     def __init__(self, body, _id=None, _ls_seq=None, _peers=None):
         self.last_seen = 0
         if body:
@@ -142,6 +144,7 @@
     This message is used by directly connected routers to determine with whom they have
     bidirectional connectivity.
     """
+
     def __init__(self, body, _id=None, _seen_peers=None, _instance=LONG(0)):
         if body:
             self.id = getMandatory(body, 'id', PY_TEXT_TYPE)
@@ -180,6 +183,7 @@
     This message is sent periodically to indicate the originating router's sequence numbers
     for link-state and mobile-address-state.
     """
+
     def __init__(self, body, _id=None, _ls_seq=None, _mobile_seq=None, _instance=LONG(0)):
         if body:
             self.id = getMandatory(body, 'id', PY_TEXT_TYPE)
@@ -201,7 +205,7 @@
 
     def __repr__(self):
         return "RA(id=%s pv=%d area=%s inst=%d ls_seq=%d mobile_seq=%d)" % \
-                (self.id, self.version, self.area, self.instance, self.ls_seq, self.mobile_seq)
+            (self.id, self.version, self.area, self.instance, self.ls_seq, self.mobile_seq)
 
     def to_dict(self):
         return {'id'         : self.id,
@@ -215,6 +219,7 @@
 class MessageLSU(object):
     """
     """
+
     def __init__(self, body, _id=None, _ls_seq=None, _ls=None, _instance=LONG(0)):
         if body:
             self.id = getMandatory(body, 'id', PY_TEXT_TYPE)
@@ -236,7 +241,7 @@
 
     def __repr__(self):
         return "LSU(id=%s pv=%d area=%s inst=%d ls_seq=%d ls=%r)" % \
-                (self.id, self.version, self.area, self.instance, self.ls_seq, self.ls)
+            (self.id, self.version, self.area, self.instance, self.ls_seq, self.ls)
 
     def to_dict(self):
         return {'id'       : self.id,
@@ -250,6 +255,7 @@
 class MessageLSR(object):
     """
     """
+
     def __init__(self, body, _id=None):
         if body:
             self.id = getMandatory(body, 'id', PY_TEXT_TYPE)
@@ -275,6 +281,7 @@
 class MessageMAU(object):
     """
     """
+
     def __init__(self, body, _id=None, _seq=None, _add_list=None, _del_list=None, _exist_list=None, _hints=None):
         if body:
             self.id = getMandatory(body, 'id', PY_TEXT_TYPE)
@@ -303,28 +310,37 @@
         _del = ''
         _exist = ''
         _hints = ''
-        if self.add_list != None:   _add   = ' add=%r'   % self.add_list
-        if self.del_list != None:   _del   = ' del=%r'   % self.del_list
-        if self.exist_list != None: _exist = ' exist=%r' % self.exist_list
-        if self.hints != None: _hints = ' hints=%r' % self.hints
+        if self.add_list is not None:
+            _add   = ' add=%r'   % self.add_list
+        if self.del_list is not None:
+            _del   = ' del=%r'   % self.del_list
+        if self.exist_list is not None:
+            _exist = ' exist=%r' % self.exist_list
+        if self.hints is not None:
+            _hints = ' hints=%r' % self.hints
         return "MAU(id=%s pv=%d area=%s mobile_seq=%d%s%s%s%s)" % \
-                (self.id, self.version, self.area, self.mobile_seq, _add, _del, _exist, _hints)
+            (self.id, self.version, self.area, self.mobile_seq, _add, _del, _exist, _hints)
 
     def to_dict(self):
         body = {'id'         : self.id,
                 'pv'         : self.version,
                 'area'       : self.area,
-                'mobile_seq' : self.mobile_seq }
-        if self.add_list != None:   body['add']   = self.add_list
-        if self.del_list != None:   body['del']   = self.del_list
-        if self.exist_list != None: body['exist'] = self.exist_list
-        if self.hints != None: body['hints'] = self.hints
+                'mobile_seq' : self.mobile_seq}
+        if self.add_list is not None:
+            body['add']   = self.add_list
+        if self.del_list is not None:
+            body['del']   = self.del_list
+        if self.exist_list is not None:
+            body['exist'] = self.exist_list
+        if self.hints is not None:
+            body['hints'] = self.hints
         return body
 
 
 class MessageMAR(object):
     """
     """
+
     def __init__(self, body, _id=None, _have_seq=None):
         if body:
             self.id = getMandatory(body, 'id', PY_TEXT_TYPE)
diff --git a/python/qpid_dispatch_internal/router/engine.py b/python/qpid_dispatch_internal/router/engine.py
index 5c56645..7ab9d17 100644
--- a/python/qpid_dispatch_internal/router/engine.py
+++ b/python/qpid_dispatch_internal/router/engine.py
@@ -34,12 +34,13 @@
 import time
 
 ##
-## Import the Dispatch adapters from the environment.  If they are not found
-## (i.e. we are in a test bench, etc.), load the stub versions.
+# Import the Dispatch adapters from the environment.  If they are not found
+# (i.e. we are in a test bench, etc.), load the stub versions.
 ##
 from ..dispatch import IoAdapter, LogAdapter, LOG_TRACE, LOG_INFO, LOG_ERROR, LOG_WARNING, LOG_STACK_LIMIT
 from ..dispatch import TREATMENT_MULTICAST_FLOOD, TREATMENT_MULTICAST_ONCE
 
+
 class RouterEngine(object):
     """
     """
@@ -49,11 +50,11 @@
         Initialize an instance of a router for a domain.
         """
         ##
-        ## Record important information about this router instance
+        # Record important information about this router instance
         ##
         self.domain         = "domain"
         self.router_adapter = router_adapter
-        self._config        = None # Not yet loaded
+        self._config        = None  # Not yet loaded
         self._log_hello     = LogAdapter("ROUTER_HELLO")
         self._log_ls        = LogAdapter("ROUTER_LS")
         self._log_general   = LogAdapter("ROUTER")
@@ -69,17 +70,17 @@
                  (self.id, self.instance, self.max_routers))
 
         ##
-        ## Launch the sub-module engines
+        # Launch the sub-module engines
         ##
         self.node_tracker          = NodeTracker(self, self.max_routers)
         self.hello_protocol        = HelloProtocol(self, self.node_tracker)
         self.link_state_engine     = LinkStateEngine(self)
         self.path_engine           = PathEngine(self)
 
+    # ========================================================================================
+    # Adapter Entry Points - invoked from the adapter
+    # ========================================================================================
 
-    ##========================================================================================
-    ## Adapter Entry Points - invoked from the adapter
-    ##========================================================================================
     def getId(self):
         """
         Return the router's ID
@@ -95,7 +96,6 @@
                 raise ValueError("No router configuration found")
         return self._config
 
-
     def setMobileSeq(self, router_maskbit, mobile_seq):
         """
         Another router's mobile sequence number has been changed and the Python router needs to store
@@ -103,7 +103,6 @@
         """
         self.node_tracker.set_mobile_seq(router_maskbit, mobile_seq)
 
-        
     def setMyMobileSeq(self, mobile_seq):
         """
         This router's mobile sequence number has been changed and the Python router needs to store
@@ -112,7 +111,6 @@
         self.link_state_engine.set_mobile_seq(mobile_seq)
         self.link_state_engine.send_ra(time.time())
 
-        
     def linkLost(self, link_id):
         """
         The control-link to a neighbor has been dropped.  We can cancel the neighbor from the
@@ -120,7 +118,6 @@
         """
         self.node_tracker.link_lost(link_id)
 
-
     def handleTimerTick(self):
         """
         """
@@ -132,7 +129,6 @@
         except Exception:
             self.log(LOG_ERROR, "Exception in timer processing\n%s" % format_exc(LOG_STACK_LIMIT))
 
-
     def handleControlMessage(self, opcode, body, link_id, cost):
         """
         """
@@ -145,7 +141,7 @@
 
         try:
             now = time.time()
-            if   opcode == 'HELLO':
+            if opcode == 'HELLO':
                 msg = MessageHELLO(body)
                 self.log_hello(LOG_TRACE, "RCVD: %r" % msg)
                 self.hello_protocol.handle_hello(msg, now, link_id, cost)
@@ -169,7 +165,6 @@
             self.log(LOG_ERROR, "Exception in control message processing\n%s" % format_exc(LOG_STACK_LIMIT))
             self.log(LOG_ERROR, "Control message error: opcode=%s body=%r" % (opcode, body))
 
-
     def receive(self, message, link_id, cost):
         """
         This is the IoAdapter message-receive handler
@@ -181,71 +176,65 @@
             self.log(LOG_ERROR, "Exception in raw message processing: properties=%r body=%r" %
                      (message.properties, message.body))
 
-
     def getRouterData(self, kind):
         """
         """
         if kind == 'help':
-            return { 'help'           : "Get list of supported values for kind",
-                     'link-state'     : "This router's link state",
-                     'link-state-set' : "The set of link states from known routers",
-                     'next-hops'      : "Next hops to each known router"
-                     }
-        if kind == 'link-state'     : return self.neighbor_engine.link_state.to_dict()
+            return {'help'           : "Get list of supported values for kind",
+                    'link-state'     : "This router's link state",
+                    'link-state-set' : "The set of link states from known routers",
+                    'next-hops'      : "Next hops to each known router"
+                    }
+        if kind == 'link-state'     :
+            return self.neighbor_engine.link_state.to_dict()
         if kind == 'link-state-set' :
             copy = {}
-            for _id,_ls in self.link_state_engine.collection.items():
+            for _id, _ls in self.link_state_engine.collection.items():
                 copy[_id] = _ls.to_dict()
             return copy
 
-        return {'notice':'Use kind="help" to get a list of possibilities'}
+        return {'notice': 'Use kind="help" to get a list of possibilities'}
 
+    # ========================================================================================
+    # Adapter Calls - outbound calls to Dispatch
+    # ========================================================================================
 
-    ##========================================================================================
-    ## Adapter Calls - outbound calls to Dispatch
-    ##========================================================================================
     def log(self, level, text):
         """
         Emit a log message to the host's event log
         """
-        info = extract_stack(limit=2)[0] # Caller frame info
+        info = extract_stack(limit=2)[0]  # Caller frame info
         self._log_general.log(level, text, info[0], info[1])
 
-
     def log_hello(self, level, text):
         """
         Emit a log message to the host's event log
         """
-        info = extract_stack(limit=2)[0] # Caller frame info
+        info = extract_stack(limit=2)[0]  # Caller frame info
         self._log_hello.log(level, text, info[0], info[1])
 
-
     def log_ls(self, level, text):
         """
         Emit a log message to the host's event log
         """
-        info = extract_stack(limit=2)[0] # Caller frame info
+        info = extract_stack(limit=2)[0]  # Caller frame info
         self._log_ls.log(level, text, info[0], info[1])
 
-
     def log_ma(self, level, text):
         """
         Emit a log message to the host's event log
         """
-        info = extract_stack(limit=2)[0] # Caller frame info
+        info = extract_stack(limit=2)[0]  # Caller frame info
         self._log_ma.log(level, text, info[0], info[1])
 
-
     def send(self, dest, msg):
         """
         Send a control message to another router.
         """
-        app_props = {'opcode' : msg.get_opcode() }
+        app_props = {'opcode' : msg.get_opcode()}
         self.io_adapter[0].send(Message(address=dest, properties=app_props, body=msg.to_dict()), True, True)
 
-
     def node_updated(self, addr, reachable, neighbor):
         """
         """
         self.router_adapter(addr, reachable, neighbor)
-
diff --git a/python/qpid_dispatch_internal/router/hello.py b/python/qpid_dispatch_internal/router/hello.py
index 9bbc900..9bbb6bb 100644
--- a/python/qpid_dispatch_internal/router/hello.py
+++ b/python/qpid_dispatch_internal/router/hello.py
@@ -32,6 +32,7 @@
     """
     This module is responsible for running the HELLO protocol.
     """
+
     def __init__(self, container, node_tracker):
         self.container        = container
         self.node_tracker     = node_tracker
@@ -43,7 +44,6 @@
         self.hellos           = {}
         self.dup_reported     = False
 
-
     def tick(self, now):
         self._expire_hellos(now)
         self.ticks += 1.0
@@ -53,7 +53,6 @@
             self.container.send('amqp:/_local/qdhello', msg)
             self.container.log_hello(LOG_TRACE, "SENT: %r" % msg)
 
-
     def handle_hello(self, msg, now, link_id, cost):
         if msg.id == self.id:
             if not self.dup_reported and (msg.instance != self.container.instance):
@@ -64,7 +63,6 @@
         if msg.is_seen(self.id):
             self.node_tracker.neighbor_refresh(msg.id, msg.version, msg.instance, link_id, cost, now)
 
-
     def _expire_hellos(self, now):
         """
         Expire local records of received hellos.  This is not involved in the
@@ -74,4 +72,3 @@
             if now - last_seen > self.hello_max_age:
                 self.hellos.pop(key)
                 self.container.log_hello(LOG_TRACE, "HELLO peer expired: %s" % key)
-
diff --git a/python/qpid_dispatch_internal/router/link.py b/python/qpid_dispatch_internal/router/link.py
index 3b46722..8569dca 100644
--- a/python/qpid_dispatch_internal/router/link.py
+++ b/python/qpid_dispatch_internal/router/link.py
@@ -25,10 +25,12 @@
 from .data import MessageRA, MessageLSU, MessageLSR
 from ..dispatch import LOG_TRACE
 
+
 class LinkStateEngine(object):
     """
     This module is responsible for running the Link State protocol.
     """
+
     def __init__(self, container):
         self.container = container
         self.node_tracker = container.node_tracker
@@ -38,11 +40,9 @@
         self.last_ra_time = 0
         self.mobile_seq   = 0
 
-
     def set_mobile_seq(self, mobile_seq):
         self.mobile_seq = mobile_seq
 
-
     def tick(self, now):
         interval = self.ra_interval_stable
         if self.node_tracker.in_flux_mode(now):
@@ -50,19 +50,16 @@
         if now - self.last_ra_time >= interval:
             self.send_ra(now)
 
-
     def handle_ra(self, msg, now):
         if msg.id == self.id:
             return
         self.node_tracker.ra_received(msg.id, msg.version, msg.ls_seq, msg.mobile_seq, msg.instance, now)
 
-
     def handle_lsu(self, msg, now):
         if msg.id == self.id:
             return
         self.node_tracker.link_state_received(msg.id, msg.version, msg.ls, msg.instance, now)
 
-
     def handle_lsr(self, msg, now):
         if msg.id == self.id:
             return
@@ -72,13 +69,11 @@
         self.container.send('amqp:/_topo/%s/%s/qdrouter' % (msg.area, msg.id), smsg)
         self.container.log_ls(LOG_TRACE, "SENT: %r" % smsg)
 
-
     def send_lsr(self, _id):
         msg = MessageLSR(None, self.id)
         self.container.send('amqp:/_topo/0/%s/qdrouter' % _id, msg)
         self.container.log_ls(LOG_TRACE, "SENT: %r to: %s" % (msg, _id))
 
-
     def send_ra(self, now):
         self.last_ra_time = now
         ls_seq = self.node_tracker.link_state.ls_seq
diff --git a/python/qpid_dispatch_internal/router/message.py b/python/qpid_dispatch_internal/router/message.py
index eb3ef7a..b054644 100644
--- a/python/qpid_dispatch_internal/router/message.py
+++ b/python/qpid_dispatch_internal/router/message.py
@@ -24,6 +24,7 @@
 
 """Python class to hold message data"""
 
+
 class Message(object):
     """
     Holder for message attributes used by python IoAdapter send/receive.
@@ -49,7 +50,8 @@
 
     def __repr__(self):
         return "%s(%s)" % (type(self).__name__,
-                           ", ".join("%s=%r"%(f, getattr(self, f)) for f in self._fields))
+                           ", ".join("%s=%r" % (f, getattr(self, f)) for f in self._fields))
+
 
 def simplify(msg):
     m = {}
@@ -61,5 +63,6 @@
         m["content_type"] = msg.content_type
     return m
 
+
 def messages_to_json(msgs):
     return json.dumps([simplify(m) for m in msgs], indent=4)
diff --git a/python/qpid_dispatch_internal/router/node.py b/python/qpid_dispatch_internal/router/node.py
index aed6870..42d68fd 100644
--- a/python/qpid_dispatch_internal/router/node.py
+++ b/python/qpid_dispatch_internal/router/node.py
@@ -36,6 +36,7 @@
     This module is also responsible for assigning a unique mask bit value to each router.
     The mask bit is used in the main router to represent sets of valid destinations for addresses.
     """
+
     def __init__(self, container, max_routers):
         self.container             = container
         self.my_id                 = container.id
@@ -57,31 +58,29 @@
         self.flux_interval    = self.container.config.raIntervalFluxSeconds * 2
         self.container.router_adapter.get_agent().add_implementation(self, "router.node")
 
-
     def refresh_entity(self, attributes):
         """Refresh management attributes"""
         attributes.update({
             "id": self.my_id,
             "index": 0,
             "protocolVersion": ProtocolVersion,
-            "instance": self.container.instance, # Boot number, integer
-            "linkState": [ls for ls in self.link_state.peers], # List of neighbour nodes
-            "nextHop":  "(self)",
+            "instance": self.container.instance,  # Boot number, integer
+            "linkState": [ls for ls in self.link_state.peers],  # List of neighbour nodes
+            "nextHop": "(self)",
             "validOrigins": [],
             "address": Address.topological(self.my_id, area=self.container.area),
             "lastTopoChange" : self.last_topology_change
         })
 
-
     def _do_expirations(self, now):
         """
         Run through the list of routers and check for expired conditions
         """
         for node_id, node in dict_items(self.nodes):
             ##
-            ## If the node is a neighbor, check the neighbor refresh time to see
-            ## if we've waited too long for a refresh.  If so, disconnect the link
-            ## and remove the node from the local link state.
+            # If the node is a neighbor, check the neighbor refresh time to see
+            # if we've waited too long for a refresh.  If so, disconnect the link
+            # and remove the node from the local link state.
             ##
             if node.is_neighbor():
                 if now - node.neighbor_refresh_time > self.neighbor_max_age:
@@ -90,7 +89,7 @@
                         self.link_state_changed = True
 
             ##
-            ## Check the age of the node's link state.  If it's too old, clear it out.
+            # Check the age of the node's link state.  If it's too old, clear it out.
             ##
             if now - node.link_state.last_seen > self.ls_max_age:
                 if node.link_state.has_peers():
@@ -98,8 +97,8 @@
                     self.recompute_topology = True
 
             ##
-            ## If the node has empty link state, check to see if it appears in any other
-            ## node's link state.  If it does not, then delete the node.
+            # If the node has empty link state, check to see if it appears in any other
+            # node's link state.  If it does not, then delete the node.
             ##
             if not node.link_state.has_peers() and not node.is_neighbor():
                 delete_node = True
@@ -110,27 +109,26 @@
                             break
                 if delete_node:
                     ##
-                    ## The keep_alive_count is set to zero when a new node is first
-                    ## discovered.  Since we can learn about a node before we receive
-                    ## its link state, the keep_alive_count is used to prevent the
-                    ## node from being deleted before we can learn more about it.
+                    # The keep_alive_count is set to zero when a new node is first
+                    # discovered.  Since we can learn about a node before we receive
+                    # its link state, the keep_alive_count is used to prevent the
+                    # node from being deleted before we can learn more about it.
                     ##
                     node.keep_alive_count += 1
                     if node.keep_alive_count > 2:
                         node.delete()
                         self.nodes.pop(node_id)
 
-
     def tick(self, now):
         send_ra = False
 
         ##
-        ## Expire neighbors and link state
+        # Expire neighbors and link state
         ##
         self._do_expirations(now)
 
         ##
-        ## Enter flux mode if things are changing
+        # Enter flux mode if things are changing
         ##
         if self.link_state_changed or self.recompute_topology:
             self.last_topology_change = int(round(now))
@@ -139,7 +137,7 @@
                 self.container.log(LOG_TRACE, "Entered Router Flux Mode")
 
         ##
-        ## Handle local link state changes
+        # Handle local link state changes
         ##
         if self.link_state_changed:
             self.link_state_changed = False
@@ -149,7 +147,7 @@
             self.container.log_ls(LOG_TRACE, "Local Link State: %r" % self.link_state)
 
         ##
-        ## Recompute the topology
+        # Recompute the topology
         ##
         if self.recompute_topology:
             self.recompute_topology = False
@@ -163,12 +161,12 @@
             self.container.log_ls(LOG_INFO, "Computed radius: %d" % radius)
 
             ##
-            ## Update the topology radius
+            # Update the topology radius
             ##
             self.container.router_adapter.set_radius(radius)
 
             ##
-            ## Update the next hops and valid origins for each node
+            # Update the next hops and valid origins for each node
             ##
             for node_id, next_hop_id in next_hops.items():
                 node     = self.nodes[node_id]
@@ -180,8 +178,8 @@
                 node.set_cost(cost)
 
         ##
-        ## Send link-state requests and mobile-address requests to the nodes
-        ## that have pending requests and are reachable
+        # Send link-state requests and mobile-address requests to the nodes
+        # that have pending requests and are reachable
         ##
         for node_id, node in self.nodes.items():
             if node.link_state_requested():
@@ -190,12 +188,11 @@
                 self.container.router_adapter.mobile_seq_advanced(node.maskbit)
 
         ##
-        ## Send an immediate RA if our link state changed
+        # Send an immediate RA if our link state changed
         ##
         if send_ra:
             self.container.link_state_engine.send_ra(now)
 
-
     def neighbor_refresh(self, node_id, version, instance, link_id, cost, now):
         """
         Invoked when the hello protocol has received positive confirmation
@@ -203,21 +200,21 @@
         """
 
         ##
-        ## If the node id is not known, create a new RouterNode to track it.
+        # If the node id is not known, create a new RouterNode to track it.
         ##
         if node_id not in self.nodes:
             self.nodes[node_id] = RouterNode(self, node_id, version, instance)
         node = self.nodes[node_id]
 
         ##
-        ## Add the version if we haven't already done so.
+        # Add the version if we haven't already done so.
         ##
-        if node.version == None:
+        if node.version is None:
             node.version = version
 
         ##
-        ## Set the link_id to indicate this is a neighbor router.  If the link_id
-        ## changed, update the index and add the neighbor to the local link state.
+        # Set the link_id to indicate this is a neighbor router.  If the link_id
+        # changed, update the index and add the neighbor to the local link state.
         ##
         if node.set_link_id(link_id):
             self.nodes_by_link_id[link_id] = node
@@ -226,19 +223,18 @@
                 self.link_state_changed = True
 
         ##
-        ## Update the refresh time for later expiration checks
+        # Update the refresh time for later expiration checks
         ##
         node.neighbor_refresh_time = now
 
         ##
-        ## If the instance was updated (i.e. the neighbor restarted suddenly),
-        ## schedule a topology recompute and a link-state-request to that router.
+        # If the instance was updated (i.e. the neighbor restarted suddenly),
+        # schedule a topology recompute and a link-state-request to that router.
         ##
         if node.update_instance(instance, version):
             self.recompute_topology = True
             node.request_link_state()
 
-
     def link_lost(self, link_id):
         """
         Invoked when an inter-router link is dropped.
@@ -252,7 +248,6 @@
             if self.link_state.del_peer(node_id):
                 self.link_state_changed = True
 
-
     def set_mobile_seq(self, router_maskbit, mobile_seq):
         """
         """
@@ -261,7 +256,6 @@
                 node.mobile_address_sequence = mobile_seq
                 return
 
-
     def in_flux_mode(self, now):
         result = (now - self.last_topology_change) <= self.flux_interval
         if not result and self.flux_mode:
@@ -269,52 +263,50 @@
             self.container.log(LOG_TRACE, "Exited Router Flux Mode")
         return result
 
-
     def ra_received(self, node_id, version, ls_seq, mobile_seq, instance, now):
         """
         Invoked when a router advertisement is received from another router.
         """
         ##
-        ## If the node id is not known, create a new RouterNode to track it.
+        # If the node id is not known, create a new RouterNode to track it.
         ##
         if node_id not in self.nodes:
             self.nodes[node_id] = RouterNode(self, node_id, version, instance)
         node = self.nodes[node_id]
 
         ##
-        ## Add the version if we haven't already done so.
+        # Add the version if we haven't already done so.
         ##
         if node.version is None:
             node.version = version
 
         ##
-        ## If the instance was updated (i.e. the router restarted suddenly),
-        ## schedule a topology recompute and a link-state-request to that router.
+        # If the instance was updated (i.e. the router restarted suddenly),
+        # schedule a topology recompute and a link-state-request to that router.
         ##
         if node.update_instance(instance, version):
             self.recompute_topology = True
             node.request_link_state()
 
         ##
-        ## Update the last seen time to now to control expiration of the link state.
+        # Update the last seen time to now to control expiration of the link state.
         ##
         node.link_state.last_seen = now
 
         ##
-        ## Check the link state sequence.  Send a link state request if our records are
-        ## not up to date.
+        # Check the link state sequence.  Send a link state request if our records are
+        # not up to date.
         ##
         if node.link_state.ls_seq < ls_seq:
             self.container.link_state_engine.send_lsr(node_id)
 
         ##
-        ## Check the mobile sequence.  Send a mobile-address-request if we are
-        ## behind the advertized sequence.
+        # Check the mobile sequence.  Send a mobile-address-request if we are
+        # behind the advertized sequence.
         ##
         if node.mobile_address_sequence < mobile_seq:
             node.mobile_address_request()
 
-
     def router_learned(self, node_id, version):
         """
         Invoked when we learn about another router by any means
@@ -322,27 +314,26 @@
         if node_id not in self.nodes and node_id != self.my_id:
             self.nodes[node_id] = RouterNode(self, node_id, version, None)
 
-
     def link_state_received(self, node_id, version, link_state, instance, now):
         """
         Invoked when a link state update is received from another router.
         """
         ##
-        ## If the node id is not known, create a new RouterNode to track it.
+        # If the node id is not known, create a new RouterNode to track it.
         ##
         if node_id not in self.nodes:
             self.nodes[node_id] = RouterNode(self, node_id, version, instance)
         node = self.nodes[node_id]
 
         ##
-        ## Add the version if we haven't already done so.
+        # Add the version if we haven't already done so.
         ##
         if node.version is None:
             node.version = version
 
         ##
-        ## If the new link state is more up-to-date than the stored link state,
-        ## update it and schedule a topology recompute.
+        # If the new link state is more up-to-date than the stored link state,
+        # update it and schedule a topology recompute.
         ##
         if link_state.ls_seq > node.link_state.ls_seq:
             node.link_state = link_state
@@ -350,25 +341,22 @@
             self.recompute_topology = True
 
             ##
-            ## Look through the new link state for references to nodes that we don't
-            ## know about.  Schedule link state requests for those nodes to be sent
-            ## after we next recompute the topology.
+            # Look through the new link state for references to nodes that we don't
+            # know about.  Schedule link state requests for those nodes to be sent
+            # after we next recompute the topology.
             ##
             for peer in node.link_state.peers:
                 if peer not in self.nodes:
                     self.router_learned(peer, None)
 
-
     def router_node(self, node_id):
         return self.nodes[node_id]
 
-
     def link_id_to_node_id(self, link_id):
         if link_id in self.nodes_by_link_id:
             return self.nodes_by_link_id[link_id].id
         return None
 
-
     def _allocate_maskbit(self):
         if self.next_maskbit is None:
             raise Exception("Exceeded Maximum Router Count")
@@ -381,14 +369,12 @@
                 break
         return result
 
-
     def _free_maskbit(self, i):
         self.maskbits[i] = None
         if self.next_maskbit is None or i < self.next_maskbit:
             self.next_maskbit = i
 
 
-
 class RouterNode(object):
     """
     RouterNode is used to track remote routers in the router network.
@@ -422,9 +408,9 @@
             "id": self.id,
             "index": self.maskbit,
             "protocolVersion": self.version,
-            "instance": self.instance, # Boot number, integer
-            "linkState": [ls for ls in self.link_state.peers], # List of neighbour nodes
-            "nextHop":  self.next_hop_router and self.next_hop_router.id,
+            "instance": self.instance,  # Boot number, integer
+            "linkState": [ls for ls in self.link_state.peers],  # List of neighbour nodes
+            "nextHop": self.next_hop_router and self.next_hop_router.id,
             "validOrigins": self.valid_origins,
             "address": Address.topological(self.id, area=self.parent.container.area),
             "routerLink": self.peer_link_id,
@@ -439,7 +425,6 @@
             return "%s;class=%c;phase=%c" % (addr[2:], cls, phase)
         return "%s;class=%c" % (addr[1:], cls)
 
-
     def set_link_id(self, link_id):
         if self.peer_link_id == link_id:
             return False
@@ -450,14 +435,12 @@
         self.log(LOG_TRACE, "Node %s link set: link_id=%r (removed next hop)" % (self.id, link_id))
         return True
 
-
     def remove_link(self):
         if self.peer_link_id is not None:
             self.peer_link_id = None
             self.adapter.remove_link(self.maskbit)
             self.log(LOG_TRACE, "Node %s link removed" % self.id)
 
-
     def delete(self):
         self.adapter.get_agent().remove_implementation(self)
         self.unmap_all_addresses()
@@ -465,12 +448,11 @@
         self.parent._free_maskbit(self.maskbit)
         self.log(LOG_TRACE, "Node %s deleted" % self.id)
 
-
     def set_next_hop(self, next_hop):
         if self.id == next_hop.id:
             ##
-            ## If the next hop is self (destination is a neighbor) and there
-            ## was a next hop in place, explicitly remove the next hop (DISPATCH-873).
+            # If the next hop is self (destination is a neighbor) and there
+            # was a next hop in place, explicitly remove the next hop (DISPATCH-873).
             ##
             self.remove_next_hop()
             return
@@ -480,7 +462,6 @@
         self.adapter.set_next_hop(self.maskbit, next_hop.maskbit)
         self.log(LOG_TRACE, "Node %s next hop set: %s" % (self.id, next_hop.id))
 
-
     def set_valid_origins(self, valid_origins):
         if self.valid_origins == valid_origins:
             return
@@ -489,7 +470,6 @@
         self.adapter.set_valid_origins(self.maskbit, vo_mb)
         self.log(LOG_TRACE, "Node %s valid origins: %r" % (self.id, valid_origins))
 
-
     def set_cost(self, cost):
         if self.cost == cost:
             return
@@ -497,18 +477,15 @@
         self.adapter.set_cost(self.maskbit, cost)
         self.log(LOG_TRACE, "Node %s cost: %d" % (self.id, cost))
 
-
     def remove_next_hop(self):
         if self.next_hop_router:
             self.next_hop_router = None
             self.adapter.remove_next_hop(self.maskbit)
             self.log(LOG_TRACE, "Node %s next hop removed" % self.id)
 
-
     def is_neighbor(self):
         return self.peer_link_id is not None
 
-
     def request_link_state(self):
         """
         Set the link-state-requested flag so we can send this node a link-state
@@ -516,7 +493,6 @@
         """
         self.need_ls_request = True
 
-
     def link_state_requested(self):
         """
         Return True iff we need to request this node's link state AND the node is
@@ -529,11 +505,9 @@
             return True
         return False
 
-
     def mobile_address_request(self):
         self.need_mobile_request = True
 
-
     def mobile_address_requested(self):
         if self.need_mobile_request and (self.peer_link_id is not None or
                                          self.next_hop_router is not None):
@@ -541,13 +515,11 @@
             return True
         return False
 
-
     def unmap_all_addresses(self):
         self.mobile_address_sequence = 0
         self.adapter.flush_destinations(self.maskbit)
         self.log(LOG_DEBUG, "Remote destinations flushed from router %s" % (self.id))
 
-
     def update_instance(self, instance, version):
         if instance is None:
             return False
@@ -563,4 +535,3 @@
         self.unmap_all_addresses()
         self.log(LOG_INFO, "Detected Restart of Router Node %s" % self.id)
         return True
-
diff --git a/python/qpid_dispatch_internal/router/path.py b/python/qpid_dispatch_internal/router/path.py
index cc089d5..eabb50c 100644
--- a/python/qpid_dispatch_internal/router/path.py
+++ b/python/qpid_dispatch_internal/router/path.py
@@ -25,32 +25,33 @@
 from ..compat import dict_items
 from ..compat import dict_keys
 
+
 class PathEngine(object):
     """
     This module is responsible for computing the next-hop for every router in the domain
     based on the collection of link states that have been gathered.
     """
+
     def __init__(self, container):
         self.container = container
         self.id = self.container.id
 
-
     def _calculate_tree_from_root(self, root, collection):
         ##
-        ## Make a copy of the current collection of link-states that contains
-        ## a fake link-state for nodes that are known-peers but are not in the
-        ## collection currently.  This is needed to establish routes to those nodes
-        ## so we can trade link-state information with them.
+        # Make a copy of the current collection of link-states that contains
+        # a fake link-state for nodes that are known-peers but are not in the
+        # collection currently.  This is needed to establish routes to those nodes
+        # so we can trade link-state information with them.
         ##
         link_states = {}
         for _id, ls in collection.items():
             link_states[_id] = ls.peers
             for p in ls.peers:
                 if p not in link_states:
-                    link_states[p] = {_id:1}
+                    link_states[p] = {_id: 1}
 
         ##
-        ## Setup Dijkstra's Algorithm
+        # Setup Dijkstra's Algorithm
         ##
         hops = {}
         cost = {}
@@ -64,25 +65,25 @@
         unresolved = NodeSet(cost)
 
         ##
-        ## Process unresolved nodes until lowest cost paths to all reachable nodes have been found.
+        # Process unresolved nodes until lowest cost paths to all reachable nodes have been found.
         ##
         while not unresolved.empty():
             u = unresolved.lowest_cost()
-            if cost[u] == None:
+            if cost[u] is None:
                 # There are no more reachable nodes in unresolved
                 break
             for v, v_cost in link_states[u].items():
                 if unresolved.contains(v):
                     alt = cost[u] + v_cost
-                    if cost[v] == None or alt < cost[v]:
+                    if cost[v] is None or alt < cost[v]:
                         hops[v] = hops[u] + 1
                         cost[v] = alt
                         prev[v] = u
                         unresolved.set_cost(v, alt)
 
         ##
-        ## Remove unreachable nodes from the maps.  Note that this will also remove the
-        ## root node (has no previous node) from the map.
+        # Remove unreachable nodes from the maps.  Note that this will also remove the
+        # root node (has no previous node) from the map.
         ##
         for u, val in dict_items(prev):
             if not val:
@@ -91,17 +92,16 @@
                 cost.pop(u)
 
         ##
-        ## Return previous-node and cost maps.  Prev is a map of all reachable, remote nodes to
-        ## their predecessor node.  Cost is a map of all reachable nodes and their costs.
+        # Return previous-node and cost maps.  Prev is a map of all reachable, remote nodes to
+        # their predecessor node.  Cost is a map of all reachable nodes and their costs.
         ##
         return prev, cost, hops
 
-
     def _calculate_valid_origins(self, nodeset, collection):
         ##
-        ## Calculate the tree from each origin, determine the set of origins-per-dest
-        ## for which the path from origin to dest passes through us.  This is the set
-        ## of valid origins for forwarding to the destination.
+        # Calculate the tree from each origin, determine the set of origins-per-dest
+        # for which the path from origin to dest passes through us.  This is the set
+        # of valid origins for forwarding to the destination.
         ##
         valid_origin = {}         # Map of destination => List of Valid Origins
         for node in nodeset:
@@ -128,22 +128,21 @@
                     v = prev[u]
         return valid_origin
 
-
     def calculate_routes(self, collection):
         ##
-        ## Generate the shortest-path tree with the local node as root
+        # Generate the shortest-path tree with the local node as root
         ##
         prev, cost, hops = self._calculate_tree_from_root(self.id, collection)
         nodes = dict_keys(prev)
 
         ##
-        ## We will also compute the radius of the topology.  This is the number of
-        ## hops (not cost) to the most distant router from the local node
+        # We will also compute the radius of the topology.  This is the number of
+        # hops (not cost) to the most distant router from the local node
         ##
         radius = max(hops.values()) if len(hops) > 0 else 0
 
         ##
-        ## Distill the path tree into a map of next hops for each node
+        # Distill the path tree into a map of next hops for each node
         ##
         next_hops = {}
         while len(nodes) > 0:
@@ -161,51 +160,47 @@
                 next_hops[w] = u
 
         ##
-        ## Calculate the valid origins for remote routers
+        # Calculate the valid origins for remote routers
         ##
         valid_origins = self._calculate_valid_origins(dict_keys(prev), collection)
 
         return (next_hops, cost, valid_origins, radius)
 
 
-
 class NodeSet(object):
     """
     This data structure is an ordered list of node IDs, sorted in increasing order by their cost.
     Equal cost nodes are secondarily sorted by their ID in order to provide deterministic and
     repeatable ordering.
     """
+
     def __init__(self, cost_map):
         self.nodes = []
         for _id, cost in cost_map.items():
             ##
-            ## Assume that nodes are either unreachable (cost = None) or local (cost = 0)
-            ## during this initialization.
+            # Assume that nodes are either unreachable (cost = None) or local (cost = 0)
+            # during this initialization.
             ##
             if cost == 0:
                 self.nodes.insert(0, (_id, cost))
             else:
                 ##
-                ## There is no need to sort unreachable nodes by ID
+                # There is no need to sort unreachable nodes by ID
                 ##
                 self.nodes.append((_id, cost))
 
-
     def __repr__(self):
         return self.nodes.__repr__()
 
-
     def empty(self):
         return len(self.nodes) == 0
 
-
     def contains(self, _id):
         for a, b in self.nodes:
             if a == _id:
                 return True
         return False
 
-
     def lowest_cost(self):
         """
         Remove and return the lowest cost node ID.
@@ -213,7 +208,6 @@
         _id, cost = self.nodes.pop(0)
         return _id
 
-
     def set_cost(self, _id, new_cost):
         """
         Set the cost for an ID in the NodeSet and re-insert the ID so that the list
@@ -228,7 +222,7 @@
 
         index = 0
         for i, c in self.nodes:
-            if c == None or new_cost < c or (new_cost == c and _id < i):
+            if c is None or new_cost < c or (new_cost == c and _id < i):
                 break
             index += 1
 
diff --git a/python/qpid_dispatch_internal/tools/command.py b/python/qpid_dispatch_internal/tools/command.py
index 318c37b..3b0636f 100644
--- a/python/qpid_dispatch_internal/tools/command.py
+++ b/python/qpid_dispatch_internal/tools/command.py
@@ -25,7 +25,10 @@
 from __future__ import absolute_import
 from __future__ import print_function
 
-import sys, json, argparse, os
+import sys
+import json
+import argparse
+import os
 try:
     from collections.abc import Mapping, Sequence
 except ImportError:
@@ -42,6 +45,7 @@
     """
     pass
 
+
 def main(run, argv=sys.argv, parser=None):
     """
     Call run(argv) with exception handling, do appropriate sys.exit().
@@ -61,6 +65,7 @@
         print("%s: %s" % (type(e).__name__, e))
     return 1
 
+
 def check_args(args, maxargs=0, minargs=0):
     """
     Check number of arguments, raise UsageError if in correct.
@@ -74,54 +79,60 @@
         raise UsageError("Unexpected arguments: %s" % (" ".join(args[maxargs:])))
     return args + [None] * (maxargs - len(args))
 
+
 def parse_args_qdstat(BusManager, argv=None):
     parser = _qdstat_parser(BusManager)
     return parser.parse_args(args=argv)
 
+
 def parse_args_qdmanage(operations, argv=None):
     parser = _qdmanage_parser(operations)
     return parser.parse_known_args(args=argv)
 
+
 common_parser = argparse.ArgumentParser(add_help=False)
 common_parser.add_argument('--version', action='version', version=VERSION)
 common_parser.add_argument("-v", "--verbose", help="Show maximum detail",
-                           action="count") # support -vvv
+                           action="count")  # support -vvv
+
 
 def _custom_optional_arguments_parser(*args, **kwargs):
     parser = argparse.ArgumentParser(*args, **kwargs)
     parser._optionals.title = "Optional Arguments"
     return parser
 
+
 def add_connection_options(parser):
     group = parser.add_argument_group('Connection Options')
     group.add_argument("-b", "--bus", default="0.0.0.0",
-                     metavar="URL", help="URL of the messaging bus to connect to default %(default)s")
+                       metavar="URL", help="URL of the messaging bus to connect to default %(default)s")
     group.add_argument("-t", "--timeout", type=float, default=5, metavar="SECS",
-                      help="Maximum time to wait for connection in seconds default %(default)s")
+                       help="Maximum time to wait for connection in seconds default %(default)s")
     group.add_argument("--ssl-certificate", metavar="CERT",
-                     help="Client SSL certificate (PEM Format)")
+                       help="Client SSL certificate (PEM Format)")
     group.add_argument("--ssl-key", metavar="KEY",
-                     help="Client SSL private key (PEM Format)")
+                       help="Client SSL private key (PEM Format)")
     group.add_argument("--ssl-trustfile", metavar="TRUSTED-CA-DB",
-                     help="Trusted Certificate Authority Database file (PEM Format)")
+                       help="Trusted Certificate Authority Database file (PEM Format)")
     group.add_argument("--ssl-password", metavar="PASSWORD",
-                     help="Certificate password, will be prompted if not specifed.")
+                       help="Certificate password, will be prompted if not specifed.")
     # Use the --ssl-password-file option to avoid having the --ssl-password in history or scripts.
     group.add_argument("--ssl-password-file", metavar="SSL-PASSWORD-FILE",
-                     help="Certificate password, will be prompted if not specifed.")
+                       help="Certificate password, will be prompted if not specifed.")
 
     group.add_argument("--sasl-mechanisms", metavar="SASL-MECHANISMS",
-                     help="Allowed sasl mechanisms to be supplied during the sasl handshake.")
+                       help="Allowed sasl mechanisms to be supplied during the sasl handshake.")
     group.add_argument("--sasl-username", metavar="SASL-USERNAME",
-                     help="User name for SASL plain authentication")
+                       help="User name for SASL plain authentication")
     group.add_argument("--sasl-password", metavar="SASL-PASSWORD",
-                     help="Password for SASL plain authentication")
+                       help="Password for SASL plain authentication")
     # Use the --sasl-password-file option to avoid having the --sasl-password in history or scripts.
     group.add_argument("--sasl-password-file", metavar="SASL-PASSWORD-FILE",
-                     help="Password for SASL plain authentication")
+                       help="Password for SASL plain authentication")
     group.add_argument("--ssl-disable-peer-name-verify", action="store_true",
-                     help="Disables SSL peer name verification. WARNING - This option is insecure and must not be used "
-                          "in production environments")
+                       help="Disables SSL peer name verification. WARNING - This option is insecure and must not be used "
+                       "in production environments")
+
 
 def _qdstat_add_display_args(parser, BusManager):
     _group = parser.add_argument_group('Display', 'Choose what kind of \
@@ -175,6 +186,7 @@
 
     display.set_defaults(show=BusManager.displayGeneral.__name__)
 
+
 def _qdstat_parser(BusManager):
     parser = _custom_optional_arguments_parser(prog="qdstat", parents=[common_parser])
     _qdstat_add_display_args(parser, BusManager)
@@ -189,7 +201,6 @@
                         metavar="ROUTER-ID", help="Router to be queried")
     target.add_argument("-d", "--edge-router", metavar="EDGE-ROUTER-ID", help="Edge Router to be queried")
 
-
     # This limit can be used to limit the number of output rows and
     # can be used in conjunction with options
     # like -c, -l, -a, --autolinks, --linkroutes and --log.
@@ -200,42 +211,47 @@
     add_connection_options(parser)
     return parser
 
+
 def _qdmanage_add_args(parser):
     parser.add_argument("-r", "--router",
-                     metavar="ROUTER-ID", help="Router to be queried")
+                        metavar="ROUTER-ID", help="Router to be queried")
     # Edge routers are not part of the router network. Hence we need a separate option
     # to be able to query edge routers
     parser.add_argument("-d", '--edge-router', metavar="EDGE-ROUTER-ID", help='Edge Router to be queried')
-    parser.add_argument('--type', help='Type of entity to operate on.') # add choices
+    parser.add_argument('--type', help='Type of entity to operate on.')  # add choices
     parser.add_argument('--name', help='Name of entity to operate on.')
     parser.add_argument('--identity', help='Identity of entity to operate on.',
                         metavar="ID")
     parser.add_argument("--indent", type=int, default=2,
-                 help="Pretty-printing indent. -1 means don't pretty-print (default %(default)s)")
+                        help="Pretty-printing indent. -1 means don't pretty-print (default %(default)s)")
     parser.add_argument('--stdin', action='store_true',
-                  help='Read attributes as JSON map or list of maps from stdin.')
+                        help='Read attributes as JSON map or list of maps from stdin.')
     parser.add_argument('--body', help='JSON value to use as body of a non-standard operation call.')
     parser.add_argument('--properties', help='JSON map to use as properties for a non-standard operation call.')
 
+
 def _qdmanage_parser(operations):
     description = "Standard operations: %s. Use GET-OPERATIONS to find additional operations." % (", ".join(operations))
     parser = _custom_optional_arguments_parser(prog="qdmanage <operation>",
-                                     parents=[common_parser],
-                                     description=description)
+                                               parents=[common_parser],
+                                               description=description)
     _qdmanage_add_args(parser)
     add_connection_options(parser)
     return parser
 
+
 def get_password(file=None):
     if file:
         with open(file, 'r') as password_file:
-            return str(password_file.read()).strip() # Remove leading and trailing characters
+            return str(password_file.read()).strip()  # Remove leading and trailing characters
     return None
 
+
 class Sasl(object):
     """
     A simple object to hold sasl mechanisms, sasl username and password
     """
+
     def __init__(self, mechs=None, user=None, password=None, sasl_password_file=None):
         self.mechs = mechs
         self.user = user
@@ -244,6 +260,7 @@
         if self.sasl_password_file:
             self.password = get_password(self.sasl_password_file)
 
+
 def opts_url(opts):
     """Fix up default URL settings based on options"""
     url = Url(opts.bus)
@@ -254,6 +271,7 @@
 
     return url
 
+
 def opts_sasl(opts):
     url = Url(opts.bus)
     mechs, user, password, sasl_password_file = opts.sasl_mechanisms, (opts.sasl_username or url.username), (opts.sasl_password or url.password), opts.sasl_password_file
@@ -263,17 +281,18 @@
 
     return Sasl(mechs, user, password, sasl_password_file)
 
+
 def opts_ssl_domain(opts, mode=SSLDomain.MODE_CLIENT):
     """Return proton.SSLDomain from command line options or None if no SSL options specified.
     @param opts: Parsed optoins including connection_options()
     """
 
     certificate, key, trustfile, password, password_file, ssl_disable_peer_name_verify = opts.ssl_certificate,\
-                                                                                         opts.ssl_key,\
-                                                                                         opts.ssl_trustfile,\
-                                                                                         opts.ssl_password,\
-                                                                                         opts.ssl_password_file, \
-                                                                                         opts.ssl_disable_peer_name_verify
+        opts.ssl_key,\
+        opts.ssl_trustfile,\
+        opts.ssl_password,\
+        opts.ssl_password_file, \
+        opts.ssl_disable_peer_name_verify
 
     if not (certificate or trustfile):
         return None
@@ -293,4 +312,3 @@
     if certificate:
         domain.set_credentials(str(certificate), str(key), str(password))
     return domain
-
diff --git a/python/qpid_dispatch_internal/tools/display.py b/python/qpid_dispatch_internal/tools/display.py
index c55ab10..4e22cce 100644
--- a/python/qpid_dispatch_internal/tools/display.py
+++ b/python/qpid_dispatch_internal/tools/display.py
@@ -27,35 +27,39 @@
 
 
 def YN(val):
-  if val:
-    return 'Y'
-  return 'N'
+    if val:
+        return 'Y'
+    return 'N'
+
 
 def Commas(value):
-  sval = str(value)
-  result = ""
-  while True:
-    if len(sval) == 0:
-      return result
-    left = sval[:-3]
-    right = sval[-3:]
-    result = right + result
-    if len(left) > 0:
-      result = ',' + result
-    sval = left
+    sval = str(value)
+    result = ""
+    while True:
+        if len(sval) == 0:
+            return result
+        left = sval[:-3]
+        right = sval[-3:]
+        result = right + result
+        if len(left) > 0:
+            result = ',' + result
+        sval = left
+
 
 def TimeLong(value):
-  day = value // (24 * 3600)
-  time = value % (24 * 3600)
-  hour = time // 3600
-  time %= 3600
-  minutes = time // 60
-  time %= 60
-  seconds = time
-  return "%03d:%02d:%02d:%02d" % (day, hour, minutes, seconds)
+    day = value // (24 * 3600)
+    time = value % (24 * 3600)
+    hour = time // 3600
+    time %= 3600
+    minutes = time // 60
+    time %= 60
+    seconds = time
+    return "%03d:%02d:%02d:%02d" % (day, hour, minutes, seconds)
+
 
 def TimeShort(value):
-  return strftime("%X", gmtime(value / 1000000000))
+    return strftime("%X", gmtime(value / 1000000000))
+
 
 def NumKMG(value, base=1000):
     """
@@ -79,268 +83,276 @@
     # round down to a power of base:
     sx = SUFFIX[base]
     for i in range(len(sx)):
-        value /= float(base);
+        value /= float(base)
         if value < base:
             return _numCell(value, sx[i])
     return _numCell(value, sx[-1])
 
 
 class Header:
-  """ """
-  NONE = 1
-  KMG = 2    # 1000 based units
-  YN = 3
-  Y = 4
-  TIME_LONG = 5
-  TIME_SHORT = 6
-  DURATION = 7
-  COMMAS = 8
-  # This is a plain number, no formatting
-  PLAIN_NUM = 9
-  KiMiGi = 10  # 1024 based units
+    """ """
+    NONE = 1
+    KMG = 2    # 1000 based units
+    YN = 3
+    Y = 4
+    TIME_LONG = 5
+    TIME_SHORT = 6
+    DURATION = 7
+    COMMAS = 8
+    # This is a plain number, no formatting
+    PLAIN_NUM = 9
+    KiMiGi = 10  # 1024 based units
 
-  def __init__(self, text, format=NONE):
-    self.text = text
-    self.format = format
+    def __init__(self, text, format=NONE):
+        self.text = text
+        self.format = format
 
-  def __repr__(self):
-    return self.text
+    def __repr__(self):
+        return self.text
 
-  def __str__(self):
-    return self.text
+    def __str__(self):
+        return self.text
 
-  def formatted(self, value):
+    def formatted(self, value):
+        try:
+            if value is None:
+                return ''
+            if self.format == Header.NONE:
+                return value
+            if self.format == Header.PLAIN_NUM:
+                return PlainNum(value)
+            if self.format == Header.KMG:
+                return NumKMG(value)
+            if self.format == Header.KiMiGi:
+                return NumKMG(value, base=1024)
+            if self.format == Header.YN:
+                if value:
+                    return 'Y'
+                return 'N'
+            if self.format == Header.Y:
+                if value:
+                    return 'Y'
+                return ''
+            if self.format == Header.TIME_LONG:
+                return TimeLong(value)
+            if self.format == Header.TIME_SHORT:
+                return TimeShort(value)
+            if self.format == Header.DURATION:
+                if value < 0:
+                    value = 0
+                sec = value / 1000000000
+                min = sec / 60
+                hour = min / 60
+                day = hour / 24
+                result = ""
+                if day > 0:
+                    result = "%dd " % day
+                if hour > 0 or result != "":
+                    result += "%dh " % (hour % 24)
+                if min > 0 or result != "":
+                    result += "%dm " % (min % 60)
+                result += "%ds" % (sec % 60)
+                return result
+            if self.format == Header.COMMAS:
+                return Commas(value)
+        except:
+            return "?"
+
+
+def PlainNum(value):
     try:
-      if value == None:
-        return ''
-      if self.format == Header.NONE:
-        return value
-      if self.format == Header.PLAIN_NUM:
-        return PlainNum(value)
-      if self.format == Header.KMG:
-        return NumKMG(value)
-      if self.format == Header.KiMiGi:
-        return NumKMG(value, base=1024)
-      if self.format == Header.YN:
-        if value:
-          return 'Y'
-        return 'N'
-      if self.format == Header.Y:
-        if value:
-          return 'Y'
-        return ''
-      if self.format == Header.TIME_LONG:
-         return TimeLong(value)
-      if self.format == Header.TIME_SHORT:
-         return TimeShort(value)
-      if self.format == Header.DURATION:
-        if value < 0: value = 0
-        sec = value / 1000000000
+        ret_val = "%d" % value
+        return ret_val
+    except:
+        return "%s" % value
+
+
+class BodyFormat:
+    """
+    Display body format chooses between:
+     CLASSIC - original variable-width, unquoted, text delimited by white space
+     CSV     - quoted text delimited by commas
+    """
+    CLASSIC = 1
+    CSV = 2
+
+
+class CSV_CONFIG:
+    """ """
+    SEPERATOR = u','
+    STRING_QUOTE = u'"'
+
+
+class Display:
+    """ Display formatting """
+
+    def __init__(self, spacing=2, prefix="    ", bodyFormat=BodyFormat.CLASSIC):
+        self.tableSpacing    = spacing
+        self.tablePrefix     = prefix
+        self.timestampFormat = "%X"
+        if bodyFormat == BodyFormat.CLASSIC:
+            self.printTable = self.table
+        elif bodyFormat == BodyFormat.CSV:
+            self.printTable = self.tableCsv
+        else:
+            raise Exception("Table body format must be CLASSIC or CSV.")
+
+    def formattedTable(self, title, heads, rows):
+        fRows = []
+        for row in rows:
+            fRow = []
+            col = 0
+            for cell in row:
+                fRow.append(heads[col].formatted(cell))
+                col += 1
+            fRows.append(fRow)
+        headtext = []
+        for head in heads:
+            headtext.append(head.text)
+        self.printTable(title, headtext, fRows)
+
+    def table(self, title, heads, rows):
+        """ Print a table with autosized columns """
+
+        # Pad the rows to the number of heads
+        for row in rows:
+            diff = len(heads) - len(row)
+            for idx in range(diff):
+                row.append("")
+
+        print("%s" % title)
+        if len(rows) == 0:
+            return
+        colWidth = []
+        col      = 0
+        line     = self.tablePrefix
+        for head in heads:
+            width = len(head)
+            for row in rows:
+                text = UNICODE(row[col])
+                cellWidth = len(text)
+                if cellWidth > width:
+                    width = cellWidth
+            colWidth.append(width + self.tableSpacing)
+            line = line + head
+            if col < len(heads) - 1:
+                for i in range(colWidth[col] - len(head)):
+                    line = line + " "
+            col = col + 1
+        print(line)
+        line = self.tablePrefix
+        for width in colWidth:
+            for i in range(width):
+                line = line + "="
+        print(line)
+
+        for row in rows:
+            line = self.tablePrefix
+            col  = 0
+            for width in colWidth:
+                text = UNICODE(row[col])
+                line = line + text
+                if col < len(heads) - 1:
+                    for i in range(width - len(text)):
+                        line = line + " "
+                col = col + 1
+            print(line)
+
+    def tableCsv(self, title, heads, rows):
+        """
+        Print a table with CSV format.
+        """
+
+        def csvEscape(text):
+            """
+            Given a unicode text field, return the quoted CSV format for it
+            :param text: a header field or a table row field
+            :return:
+            """
+            if len(text) == 0:
+                return ""
+            else:
+                text = text.replace(CSV_CONFIG.STRING_QUOTE, CSV_CONFIG.STRING_QUOTE * 2)
+                return CSV_CONFIG.STRING_QUOTE + text + CSV_CONFIG.STRING_QUOTE
+
+        print("%s" % title)
+        if len(rows) == 0:
+            return
+
+        print(','.join([csvEscape(UNICODE(head)) for head in heads]))
+        for row in rows:
+            print(','.join([csvEscape(UNICODE(item)) for item in row]))
+
+    def do_setTimeFormat(self, fmt):
+        """ Select timestamp format """
+        if fmt == "long":
+            self.timestampFormat = "%c"
+        elif fmt == "short":
+            self.timestampFormat = "%X"
+
+    def timestamp(self, nsec):
+        """ Format a nanosecond-since-the-epoch timestamp for printing """
+        return strftime(self.timestampFormat, gmtime(nsec / 1000000000))
+
+    def duration(self, nsec):
+        if nsec < 0:
+            nsec = 0
+        sec = nsec / 1000000000
         min = sec / 60
         hour = min / 60
         day = hour / 24
         result = ""
         if day > 0:
-          result = "%dd " % day
+            result = "%dd " % day
         if hour > 0 or result != "":
-          result += "%dh " % (hour % 24)
+            result += "%dh " % (hour % 24)
         if min > 0 or result != "":
-          result += "%dm " % (min % 60)
+            result += "%dm " % (min % 60)
         result += "%ds" % (sec % 60)
         return result
-      if self.format == Header.COMMAS:
-        return Commas(value)
-    except:
-      return "?"
 
 
-def PlainNum(value):
-  try:
-    ret_val = "%d" % value
-    return ret_val
-  except:
-    return "%s" % value
-
-
-class BodyFormat:
-  """
-  Display body format chooses between:
-   CLASSIC - original variable-width, unquoted, text delimited by white space
-   CSV     - quoted text delimited by commas
-  """
-  CLASSIC = 1
-  CSV = 2
-
-class CSV_CONFIG:
-  """ """
-  SEPERATOR = u','
-  STRING_QUOTE = u'"'
-
-class Display:
-  """ Display formatting """
-  
-  def __init__(self, spacing=2, prefix="    ", bodyFormat=BodyFormat.CLASSIC):
-    self.tableSpacing    = spacing
-    self.tablePrefix     = prefix
-    self.timestampFormat = "%X"
-    if bodyFormat == BodyFormat.CLASSIC:
-      self.printTable = self.table
-    elif bodyFormat == BodyFormat.CSV:
-      self.printTable = self.tableCsv
-    else:
-      raise Exception("Table body format must be CLASSIC or CSV.")
-
-  def formattedTable(self, title, heads, rows):
-    fRows = []
-    for row in rows:
-      fRow = []
-      col = 0
-      for cell in row:
-        fRow.append(heads[col].formatted(cell))
-        col += 1
-      fRows.append(fRow)
-    headtext = []
-    for head in heads:
-      headtext.append(head.text)
-    self.printTable(title, headtext, fRows)
-
-  def table(self, title, heads, rows):
-    """ Print a table with autosized columns """
-
-    # Pad the rows to the number of heads
-    for row in rows:
-      diff = len(heads) - len(row)
-      for idx in range(diff):
-        row.append("")
-
-    print("%s" % title)
-    if len (rows) == 0:
-      return
-    colWidth = []
-    col      = 0
-    line     = self.tablePrefix
-    for head in heads:
-      width = len (head)
-      for row in rows:
-        text = UNICODE(row[col])
-        cellWidth = len(text)
-        if cellWidth > width:
-          width = cellWidth
-      colWidth.append (width + self.tableSpacing)
-      line = line + head
-      if col < len (heads) - 1:
-        for i in range (colWidth[col] - len (head)):
-          line = line + " "
-      col = col + 1
-    print(line)
-    line = self.tablePrefix
-    for width in colWidth:
-      for i in range (width):
-        line = line + "="
-    print(line)
-
-    for row in rows:
-      line = self.tablePrefix
-      col  = 0
-      for width in colWidth:
-        text = UNICODE(row[col])
-        line = line + text
-        if col < len (heads) - 1:
-          for i in range (width - len(text)):
-            line = line + " "
-        col = col + 1
-      print(line)
-
-  def tableCsv(self, title, heads, rows):
-    """
-    Print a table with CSV format.
-    """
-
-    def csvEscape(text):
-      """
-      Given a unicode text field, return the quoted CSV format for it
-      :param text: a header field or a table row field
-      :return:
-      """
-      if len(text) == 0:
-        return ""
-      else:
-        text = text.replace(CSV_CONFIG.STRING_QUOTE, CSV_CONFIG.STRING_QUOTE*2)
-        return CSV_CONFIG.STRING_QUOTE + text + CSV_CONFIG.STRING_QUOTE
-
-    print("%s" % title)
-    if len (rows) == 0:
-      return
-
-    print(','.join([csvEscape(UNICODE(head)) for head in heads]))
-    for row in rows:
-      print(','.join([csvEscape(UNICODE(item)) for item in row]))
-
-  def do_setTimeFormat (self, fmt):
-    """ Select timestamp format """
-    if fmt == "long":
-      self.timestampFormat = "%c"
-    elif fmt == "short":
-      self.timestampFormat = "%X"
-
-  def timestamp (self, nsec):
-    """ Format a nanosecond-since-the-epoch timestamp for printing """
-    return strftime (self.timestampFormat, gmtime (nsec / 1000000000))
-
-  def duration(self, nsec):
-    if nsec < 0: nsec = 0
-    sec = nsec / 1000000000
-    min = sec / 60
-    hour = min / 60
-    day = hour / 24
-    result = ""
-    if day > 0:
-      result = "%dd " % day
-    if hour > 0 or result != "":
-      result += "%dh " % (hour % 24)
-    if min > 0 or result != "":
-      result += "%dm " % (min % 60)
-    result += "%ds" % (sec % 60)
-    return result
-
 class Sortable(object):
-  """ """
-  def __init__(self, row, sortIndex):
-    self.row = row
-    self.sortIndex = sortIndex
-    if sortIndex >= len(row):
-      raise Exception("sort index exceeds row boundary")
+    """ """
 
-  def __lt__(self, other):
-    return self.row[self.sortIndex] < other.row[self.sortIndex]
+    def __init__(self, row, sortIndex):
+        self.row = row
+        self.sortIndex = sortIndex
+        if sortIndex >= len(row):
+            raise Exception("sort index exceeds row boundary")
 
-  def getRow(self):
-    return self.row
+    def __lt__(self, other):
+        return self.row[self.sortIndex] < other.row[self.sortIndex]
+
+    def getRow(self):
+        return self.row
+
 
 class Sorter:
-  """ """
-  def __init__(self, heads, rows, sortCol, limit=0, inc=True):
-    col = 0
-    for head in heads:
-      if head.text == sortCol:
-        break
-      col += 1
-    if col == len(heads):
-      raise Exception("sortCol '%s', not found in headers" % sortCol)
+    """ """
 
-    list = []
-    for row in rows:
-      list.append(Sortable(row, col))
-    list.sort()
-    if not inc:
-      list.reverse()
-    count = 0
-    self.sorted = []
-    for row in list:
-      self.sorted.append(row.getRow())
-      count += 1
-      if count == limit:
-        break
+    def __init__(self, heads, rows, sortCol, limit=0, inc=True):
+        col = 0
+        for head in heads:
+            if head.text == sortCol:
+                break
+            col += 1
+        if col == len(heads):
+            raise Exception("sortCol '%s', not found in headers" % sortCol)
 
-  def getSorted(self):
-    return self.sorted
+        list = []
+        for row in rows:
+            list.append(Sortable(row, col))
+        list.sort()
+        if not inc:
+            list.reverse()
+        count = 0
+        self.sorted = []
+        for row in list:
+            self.sorted.append(row.getRow())
+            count += 1
+            if count == limit:
+                break
+
+    def getSorted(self):
+        return self.sorted
diff --git a/python/setup.py.in b/python/setup.py.in
index 25e4ede..3962474 100755
--- a/python/setup.py.in
+++ b/python/setup.py.in
@@ -26,6 +26,7 @@
 
 """Install public packages and scripts for Qpid Dispatch."""
 
+
 class BuildPy(build_py):
     """Extend standard build command, add generated modules from binary directory."""
 
@@ -39,7 +40,8 @@
     def get_outputs(self, **kwargs):
         return build_py.get_outputs(self, **kwargs) + [join(self.build_lib, m) for m in self.MODULES]
 
-options={}
+
+options = {}
 destdir = environ.get("DESTDIR")
 if destdir:
     options["install"] = {"root": destdir}
diff --git a/run.py.in b/run.py.in
index 67cf5d1..a10709f 100755
--- a/run.py.in
+++ b/run.py.in
@@ -23,12 +23,17 @@
 from __future__ import absolute_import
 from __future__ import print_function
 
+import runpy
+import sys
+import os
+from subprocess import Popen, PIPE
+
 """
 Run a tool or test in a build tree with the correct PATH, PYTHONPATH, etc.
 Run with no arguments for help.
 """
 
-usage="""
+usage = """
 Run a tool or test in a build tree with the correct PATH, PYTHONPATH, etc.
 
 Usage:
@@ -39,8 +44,6 @@
 run.py --sh                                # Print a shell script to set the run.py environment.
 """
 
-import os, sys, runpy
-from subprocess import Popen, PIPE
 
 extra_paths = [
     "${CMAKE_SOURCE_DIR}/python",
@@ -48,11 +51,13 @@
     "${CMAKE_SOURCE_DIR}/tests"
 ]
 
+
 def dedup(l):
     """Remove duplicates from list l, keep first instance. Keep order of l."""
     s = set()
     return [i for i in l if i not in s and (s.add(i) or True)]
 
+
 def getpath(env):
     """Return a path environment variable split into a list"""
     path = os.environ.get(env)
@@ -60,6 +65,7 @@
         return path.split(os.pathsep)
     return []
 
+
 sys.path = dedup(extra_paths + sys.path)
 python_path = dedup(extra_paths + getpath("PYTHONPATH"))
 
@@ -75,8 +81,8 @@
                                    os.path.join("${CMAKE_BINARY_DIR}", 'tools'),
                                    os.path.join("${CMAKE_SOURCE_DIR}", 'bin')] +
                                   getpath('PATH'))),
-    'MANPATH' : os.pathsep.join([os.path.join("${CMAKE_BINARY_DIR}",'doc','man')] +
-                                getpath('MANPATH')),
+    'MANPATH': os.pathsep.join([os.path.join("${CMAKE_BINARY_DIR}", 'doc', 'man')] +
+                               getpath('MANPATH')),
     'SOURCE_DIR': "${CMAKE_SOURCE_DIR}",
     'BUILD_DIR': "${CMAKE_BINARY_DIR}",
     'QPID_DISPATCH_HOME': "${CMAKE_SOURCE_DIR}",
@@ -97,25 +103,31 @@
         return os.path.isfile(fpath) and os.access(fpath, os.X_OK)
     mydir, name = os.path.split(program)
     if mydir:
-        if is_exe(program): return program
+        if is_exe(program):
+            return program
     else:
         for path in os.environ["PATH"].split(os.pathsep):
             exe_file = os.path.join(path, program)
-            if is_exe(exe_file): return exe_file
+            if is_exe(exe_file):
+                return exe_file
     return None
 
+
 def is_binary_exe(program):
     """True if the program is a binary executable"""
-    if not program: return None
+    if not program:
+        return None
     p = Popen(['file', '-bi', program], stdout=PIPE, stderr=PIPE)
     return p.communicate()[0].startswith('application/x-executable')
 
+
 def run_path(file_path, run_name=None):
     """Wrapper for run path that falls back to exec python for python < 2.7"""
     if hasattr(runpy, 'run_path'):
         runpy.run_path(file_path, run_name=run_name)
     else:                       # Python < 2.7
-        os.execvp(sys.executable, [sys.executable]+sys.argv)
+        os.execvp(sys.executable, [sys.executable] + sys.argv)
+
 
 if __name__ == "__main__":
     error_prefix = ""
@@ -124,26 +136,26 @@
             print("%s" % usage)
         elif sys.argv[1] == '-m':
             sys.argv = sys.argv[2:]
-            error_prefix = "Run python module '%s': "%(sys.argv[0])
+            error_prefix = "Run python module '%s': " % (sys.argv[0])
             runpy.run_module(sys.argv[0], alter_sys=True, run_name="__main__")
         elif sys.argv[1] == '-s':
             sys.argv = sys.argv[2:]
-            error_prefix = "Run python script '%s':"%(sys.argv[0])
+            error_prefix = "Run python script '%s':" % (sys.argv[0])
             run_path(sys.argv[0], run_name="__main__")
         elif sys.argv[1] == '--sh':
-            for name, value in env_vars.items(): print('%s="%s"'%(name, value))
-            print("export %s"%' '.join(env_vars.keys()))
+            for name, value in env_vars.items():
+                print('%s="%s"' % (name, value))
+            print("export %s" % ' '.join(env_vars.keys()))
         elif sys.argv[1] == '-x':
             args = qdrouterd_runner.split() + sys.argv[2:]
-            error_prefix = "Running '%s': "%(args)
+            error_prefix = "Running '%s': " % (args)
             os.execvp(args[0], args)
         elif sys.argv[1].startswith('-'):
             print(usage)
         else:
             args = sys.argv[1:]
-            error_prefix = "Running '%s': "%(args)
+            error_prefix = "Running '%s': " % (args)
             os.execvp(args[0], args)
     except Exception as e:
-        print("%s%s: %s"%(error_prefix, type(e).__name__, e))
+        print("%s%s: %s" % (error_prefix, type(e).__name__, e))
         raise
-
diff --git a/src/schema_c.py b/src/schema_c.py
index 3ce2e93..7b556e2 100644
--- a/src/schema_c.py
+++ b/src/schema_c.py
@@ -29,7 +29,7 @@
 from qpid_dispatch_internal.management.schema import EnumType
 from qpid_dispatch_internal.management.qdrouter import QdSchema
 
-copyright="""/*
+copyright = """/*
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
  * distributed with this work for additional information
@@ -61,14 +61,14 @@
         self.generate_enums()
 
     def header(self, name, text):
-        with open(name+'.h', 'w') as f:
-            f.write("#ifndef __%s_h__\n#define __%s_h__\n"%(name, name) + copyright + text + "\n#endif\n")
+        with open(name + '.h', 'w') as f:
+            f.write("#ifndef __%s_h__\n#define __%s_h__\n" % (name, name) + copyright + text + "\n#endif\n")
 
     def source(self, name, text):
-        with open(name+'.c', 'w') as f:
+        with open(name + '.c', 'w') as f:
             f.write(copyright + text)
 
-    def identifier(self, name): return re.sub(r'\W','_', name)
+    def identifier(self, name): return re.sub(r'\W', '_', name)
 
     def underscore(self, names): return '_'.join([self.identifier(name) for name in names])
 
@@ -96,7 +96,7 @@
 
         def defn(self):
             return "const char *%s[%s] = {\n" % (self.array, self.count) + \
-                ",\n".join('    "%s"'%(self.name(tag)) for tag in self.tags) + \
+                ",\n".join('    "%s"' % (self.name(tag)) for tag in self.tags) + \
                 "\n};\n\n"
 
     def generate_enums(self):
@@ -107,5 +107,6 @@
         self.header('schema_enum', '\n'.join(e.decl() for e in enums))
         self.source('schema_enum', '#include "schema_enum.h"\n\n' + '\n'.join(e.defn() for e in enums))
 
+
 if __name__ == '__main__':
     Generator()
diff --git a/tests/TCP_echo_server.py b/tests/TCP_echo_server.py
index b3c3ba0..3fe9b94 100755
--- a/tests/TCP_echo_server.py
+++ b/tests/TCP_echo_server.py
@@ -48,6 +48,7 @@
     the inbound and outbound data list buffers for this
     socket's payload.
     """
+
     def __init__(self, address):
         self.addr = address
         self.inb = b''
diff --git a/tests/authservice.py.in b/tests/authservice.py.in
index 9ac9fee..9c235b8 100755
--- a/tests/authservice.py.in
+++ b/tests/authservice.py.in
@@ -23,12 +23,15 @@
 from __future__ import absolute_import
 from __future__ import print_function
 
-import sys, signal, optparse
+import sys
+import signal
+import optparse
 from proton.handlers import MessagingHandler
 from proton.reactor import Container
 from proton import Array, Data, symbol, UNDESCRIBED
 from cproton import pn_sasl_config_path
 
+
 class AuthService(MessagingHandler):
     def __init__(self, address):
         super(AuthService, self).__init__()
@@ -37,7 +40,7 @@
         self.allow('admin', '*', ['send', 'recv'])
         self.allow('guest', 'foo', ['send', 'recv'])
         self.listener = None
-        self.tmo = 0.1 # seconds
+        self.tmo = 0.1  # seconds
         self.stop_req = False
 
     def allow(self, user, address, permissions):
@@ -73,6 +76,7 @@
         else:
             event.reactor.schedule(self.tmo, self)
 
+
 parser = optparse.OptionParser(usage="usage: %prog [options]",
                                description="test authentication and authorization service")
 parser.add_option("-a", "--address", default="localhost:55671",
@@ -87,9 +91,11 @@
 
 handler = AuthService(opts.address)
 
+
 def sigterm_handler(_signo, _stack_frame):
     handler.stop()
 
+
 signal.signal(signal.SIGTERM, sigterm_handler)
 
 Container(handler).run()
diff --git a/tests/failoverserver.py.in b/tests/failoverserver.py.in
index b973a13..589acf8 100644
--- a/tests/failoverserver.py.in
+++ b/tests/failoverserver.py.in
@@ -24,7 +24,9 @@
 from __future__ import absolute_import
 from __future__ import print_function
 
-import signal, optparse, sys
+import signal
+import optparse
+import sys
 from proton.handlers import MessagingHandler
 from proton.reactor import Container
 from proton import symbol
@@ -69,4 +71,4 @@
 
 signal.signal(signal.SIGTERM, sigterm_handler)
 
-Container(handler).run()
\ No newline at end of file
+Container(handler).run()
diff --git a/tests/friendship_server.py b/tests/friendship_server.py
index d8e21b2..18b3444 100644
--- a/tests/friendship_server.py
+++ b/tests/friendship_server.py
@@ -31,6 +31,7 @@
     Implementation of the gRPC FriendshipServicer.
     See the friendship.proto definition for more info.
     """
+
     def __init__(self):
         self.people = list()
 
diff --git a/tests/http2_server.py b/tests/http2_server.py
index 1f1ee5f..18bed47 100644
--- a/tests/http2_server.py
+++ b/tests/http2_server.py
@@ -16,13 +16,15 @@
 # specific language governing permissions and limitations
 # under the License.
 #
+import system_test
 import os
 from quart import Quart, request
 from quart.static import send_file
 from quart.exceptions import HTTPStatusException
 import json
 app = Quart(__name__)
-import system_test
+
+
 class MyInfo(object):
     def __init__(self, fname, lname, id=None):
         self.fname = fname
@@ -31,17 +33,21 @@
         #self.hobby = None
         #self.style = None
 
+
 my_info = MyInfo(fname="John", lname="Doe")
 
+
 def image_file(name):
     return os.path.join(system_test.DIR, 'images', name)
 
+
 @app.route("/myinfo/delete/<id>", methods=["DELETE"])
 async def delete_myinfo(id):  # noqa
     my_info.id = id
     jsonStr = json.dumps(my_info.__dict__)
     return jsonStr
-    
+
+
 @app.route('/myinfo', methods=['GET', 'POST', 'PUT'])
 async def create_myinfo():
     form = await request.form
@@ -50,6 +56,7 @@
     message = "Success! Your first name is %s, last name is %s" % (fname, lname)
     return message
 
+
 def large_string(length):
     i = 0
     ret_string = ""
@@ -58,29 +65,36 @@
         i += 1
     return ret_string
 
+
 @app.route('/')
 async def index():
     return large_string(1000)
 
+
 @app.route('/largeget', methods=['GET'])
 async def largeget():
     return large_string(50000)
 
+
 @app.route('/patch', methods=['PATCH'])
 async def patch():
     data = await request.data
     return data
 
 # Return a 500 error, "Service Unavailable"
+
+
 @app.route('/test/500')
 async def service_unavailable():
     raise HTTPStatusException()
 
+
 @app.route('/images/balanced-routing.png', methods=['GET'])
 async def get_png_images():
     img_file = image_file("balanced-routing.png")
     return await send_file(img_file, mimetype='image/png')
 
+
 @app.route('/images/apache.jpg', methods=['GET'])
 async def get_jpg_images():
     img_file = image_file("apache.jpg")
diff --git a/tests/management/__init__.py b/tests/management/__init__.py
index 3bfcbce..52e26a7 100644
--- a/tests/management/__init__.py
+++ b/tests/management/__init__.py
@@ -1,20 +1,20 @@
 ##
-## Licensed to the Apache Software Foundation (ASF) under one
-## or more contributor license agreements.  See the NOTICE file
-## distributed with this work for additional information
-## regarding copyright ownership.  The ASF licenses this file
-## to you 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
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you 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
+# 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
+# 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
 ##
 
 """Management unit test package"""
diff --git a/tests/management/entity.py b/tests/management/entity.py
index fa27e81..bee1d82 100644
--- a/tests/management/entity.py
+++ b/tests/management/entity.py
@@ -25,6 +25,7 @@
 import unittest
 from qpid_dispatch.management.entity import EntityBase, camelcase
 
+
 class EntityTest(unittest.TestCase):
 
     def test_camelcase(self):
@@ -42,7 +43,7 @@
 
     def test_entity(self):
         e = EntityBase({'fooBar': 'baz'}, type='container', name='x')
-        self.assertEqual(e.attributes, {'type': 'container', 'name':'x', 'fooBar': 'baz'})
+        self.assertEqual(e.attributes, {'type': 'container', 'name': 'x', 'fooBar': 'baz'})
         self.assertEqual(e.name, 'x')
         self.assertEqual(e['name'], 'x')
 
diff --git a/tests/management/qdrouter.py b/tests/management/qdrouter.py
index 2c8f7b1..d812fe9 100644
--- a/tests/management/qdrouter.py
+++ b/tests/management/qdrouter.py
@@ -17,14 +17,15 @@
 # under the License
 #
 
-#pylint: disable=wildcard-import,unused-wildcard-import,missing-docstring,too-many-public-methods
+# pylint: disable=wildcard-import,unused-wildcard-import,missing-docstring,too-many-public-methods
 
 from __future__ import unicode_literals
 from __future__ import division
 from __future__ import absolute_import
 from __future__ import print_function
 
-import unittest, sys
+import unittest
+import sys
 from qpid_dispatch_internal.management.config import Config
 
 # Dash-separated configuration file
@@ -81,6 +82,7 @@
 }
 """
 
+
 class QdrouterTest(unittest.TestCase):
     """Tests for qpid_dispatch_internal.config.qdrouter"""
 
diff --git a/tests/management/schema.py b/tests/management/schema.py
index d3fd743..e1bbe01 100644
--- a/tests/management/schema.py
+++ b/tests/management/schema.py
@@ -18,25 +18,28 @@
 #
 
 
-#pylint: disable=wildcard-import,missing-docstring,too-many-public-methods
+# pylint: disable=wildcard-import,missing-docstring,too-many-public-methods
 
 from __future__ import unicode_literals
 from __future__ import division
 from __future__ import absolute_import
 from __future__ import print_function
 
-import unittest, json
+import unittest
+import json
 from collections import OrderedDict
 from qpid_dispatch_internal.management.schema import Schema, BooleanType, EnumType, AttributeType, ValidationError, EnumValue, EntityType
 
+
 def replace_od(thing):
     """Replace OrderedDict with dict"""
     if isinstance(thing, OrderedDict):
-        return dict((k, replace_od(v)) for k,v in thing.iteritems())
+        return dict((k, replace_od(v)) for k, v in thing.iteritems())
     if isinstance(thing, list):
         return [replace_od(t) for t in thing]
     return thing
 
+
 SCHEMA_1 = {
     "prefix": "org.example",
     "entityTypes": {
@@ -48,7 +51,7 @@
                 "name": {"type": "string",
                          "required": True,
                          "unique": True},
-                "type": {"type":"string",
+                "type": {"type": "string",
                          "required": True}
             }
         },
@@ -56,7 +59,7 @@
             "attributes": {
                 "host": {"type": "string"},
                 "name": {"type": "string", "required": True, "unique": True},
-                "type": {"type":"string",  "required": True}
+                "type": {"type": "string", "required": True}
             }
         },
         "connector": {
@@ -65,13 +68,14 @@
                 "name": {"type": "string",
                          "required": True,
                          "unique": True},
-                "type": {"type":"string",
+                "type": {"type": "string",
                          "required": True}
             }
         }
     }
 }
 
+
 class SchemaTest(unittest.TestCase):
 
     def test_bool(self):
@@ -91,7 +95,7 @@
         self.assertRaises(ValidationError, e.validate, 'foo')
         self.assertRaises(ValidationError, e.validate, 3)
 
-        self.assertEqual('["x"]', json.dumps([EnumValue('x',3)]))
+        self.assertEqual('["x"]', json.dumps([EnumValue('x', 3)]))
 
     def test_attribute_def(self):
         a = AttributeType('foo', 'string', default='FOO')
@@ -102,14 +106,14 @@
         self.assertEqual('FOO', a.missing_value())
 
         a = AttributeType('foo', 'string', required=True)
-        self.assertRaises(ValidationError, a.missing_value) # Missing required value.
+        self.assertRaises(ValidationError, a.missing_value)  # Missing required value.
 
-        a = AttributeType('foo', 'string', value='FOO') # Fixed value
+        a = AttributeType('foo', 'string', value='FOO')  # Fixed value
         self.assertEqual('FOO', a.missing_value())
         self.assertEqual(a.validate('FOO'), 'FOO')
-        self.assertRaises(ValidationError, a.validate, 'XXX') # Bad fixed value
+        self.assertRaises(ValidationError, a.validate, 'XXX')  # Bad fixed value
 
-        self.assertRaises(ValidationError, AttributeType, 'foo', 'string', value='FOO', default='BAR') # Illegal
+        self.assertRaises(ValidationError, AttributeType, 'foo', 'string', value='FOO', default='BAR')  # Illegal
 
         a = AttributeType('foo', 'integer')
         self.assertEqual(3, a.validate(3))
@@ -122,34 +126,34 @@
         s = Schema()
 
         e = EntityType('MyEntity', s, attributes={
-            'foo': {'type':'string', 'default':'FOO'},
-            'req': {'type':'integer', 'required':True},
-            'e': {'type':['x', 'y']}})
+            'foo': {'type': 'string', 'default': 'FOO'},
+            'req': {'type': 'integer', 'required': True},
+            'e': {'type': ['x', 'y']}})
 
         e.init()
-        self.assertRaises(ValidationError, e.validate, {}) # Missing required 'req'
-        self.assertEqual(e.validate({'req':42}), {'foo': 'FOO', 'req': 42})
+        self.assertRaises(ValidationError, e.validate, {})  # Missing required 'req'
+        self.assertEqual(e.validate({'req': 42}), {'foo': 'FOO', 'req': 42})
 
     def test_schema_validate(self):
         s = Schema(**SCHEMA_1)
         # Duplicate unique attribute 'name'
-        m = [{'type': 'listener', 'name':'x'},
-             {'type': 'listener', 'name':'x'}]
+        m = [{'type': 'listener', 'name': 'x'},
+             {'type': 'listener', 'name': 'x'}]
         self.assertRaises(ValidationError, s.validate_all, m)
         # Duplicate singleton entity 'container'
-        m = [{'type': 'container', 'name':'x'},
-             {'type': 'container', 'name':'y'}]
+        m = [{'type': 'container', 'name': 'x'},
+             {'type': 'container', 'name': 'y'}]
         self.assertRaises(ValidationError, s.validate_all, m)
         # Valid model
-        m = [{'type': 'container', 'name':'x'},
-             {'type': 'listener', 'name':'y'}]
+        m = [{'type': 'container', 'name': 'x'},
+             {'type': 'listener', 'name': 'y'}]
         s.validate_all(m)
 
     def test_schema_entity(self):
         s = Schema(**SCHEMA_1)
         self.assertRaises(ValidationError, s.entity, {'type': 'nosuch'})
         self.assertRaises(ValidationError, s.entity, {'type': 'listener', 'nosuch': 'x'})
-        e = s.entity({'host':'foo', 'type': 'listener', 'name': 'listener-1'})
+        e = s.entity({'host': 'foo', 'type': 'listener', 'name': 'listener-1'})
         self.assertEqual(e.attributes, {'host': 'foo', 'name': 'listener-1', 'type': 'org.example.listener'})
         self.assertEqual(e['host'], 'foo')
         self.assertRaises(ValidationError, e.__setitem__, 'nosuch', 'x')
@@ -166,7 +170,9 @@
         try:
             e.nosuch = 'x'
             self.fail("Expected exception")
-        except: pass
+        except:
+            pass
+
 
 if __name__ == '__main__':
     unittest.main()
diff --git a/tests/mock/dispatch.py b/tests/mock/dispatch.py
index ca6b370..f9e6753 100644
--- a/tests/mock/dispatch.py
+++ b/tests/mock/dispatch.py
@@ -43,18 +43,19 @@
 
 
 class LogAdapter:
-  def __init__(self, mod_name):
-    self.mod_name = mod_name
+    def __init__(self, mod_name):
+        self.mod_name = mod_name
 
-  def log(self, level, text):
-    print("LOG: mod=%s level=%d text=%s" % (self.mod_name, level, text))
+    def log(self, level, text):
+        print("LOG: mod=%s level=%d text=%s" % (self.mod_name, level, text))
+
 
 class IoAdapter:
-  def __init__(self, handler, address, global_address=False):
-    self.handler = handler
-    self.address = address
-    self.global_address = global_address
+    def __init__(self, handler, address, global_address=False):
+        self.handler = handler
+        self.address = address
+        self.global_address = global_address
 
-  def send(self, address, properties, application_properties, body, correlation_id=None):
-    print("IO: send(addr=%s properties=%r application_properties=%r body=%r"
-          % (address, properties, application_properties, body))
+    def send(self, address, properties, application_properties, body, correlation_id=None):
+        print("IO: send(addr=%s properties=%r application_properties=%r body=%r"
+              % (address, properties, application_properties, body))
diff --git a/tests/router_engine_test.py b/tests/router_engine_test.py
index ba255d3..e8e16a9 100644
--- a/tests/router_engine_test.py
+++ b/tests/router_engine_test.py
@@ -28,11 +28,12 @@
 
 sys.path.append(os.path.join(os.environ["SOURCE_DIR"], "python"))
 
-from qpid_dispatch_internal.router.engine import HelloProtocol, PathEngine, NodeTracker
-from qpid_dispatch_internal.router.data import LinkState, MessageHELLO, ProtocolVersion
-from qpid_dispatch.management.entity import EntityBase
-from system_test import main_module
 from system_test import unittest
+from system_test import main_module
+from qpid_dispatch.management.entity import EntityBase
+from qpid_dispatch_internal.router.data import LinkState, MessageHELLO, ProtocolVersion
+from qpid_dispatch_internal.router.engine import HelloProtocol, PathEngine, NodeTracker
+
 
 class Adapter(object):
     def __init__(self, domain):
@@ -51,41 +52,40 @@
         print("Adapter.remote_unbind: subject=%s, peer=%s" % (subject, peer))
 
     def node_updated(self, address, reachable, neighbor, link_bit, router_bit):
-        print("Adapter.node_updated: address=%s, reachable=%r, neighbor=%r, link_bit=%d, router_bit=%d" % \
+        print("Adapter.node_updated: address=%s, reachable=%r, neighbor=%r, link_bit=%d, router_bit=%d" %
               (address, reachable, neighbor, link_bit, router_bit))
 
 
 class DataTest(unittest.TestCase):
     def test_link_state(self):
-        ls = LinkState(None, 'R1', 1, {'R2':1, 'R3':1})
+        ls = LinkState(None, 'R1', 1, {'R2': 1, 'R3': 1})
         self.assertEqual(ls.id, 'R1')
         self.assertEqual(ls.ls_seq, 1)
-        self.assertEqual(ls.peers, {'R2':1, 'R3':1})
+        self.assertEqual(ls.peers, {'R2': 1, 'R3': 1})
         ls.bump_sequence()
         self.assertEqual(ls.id, 'R1')
         self.assertEqual(ls.ls_seq, 2)
-        self.assertEqual(ls.peers, {'R2':1, 'R3':1})
+        self.assertEqual(ls.peers, {'R2': 1, 'R3': 1})
 
         result = ls.add_peer('R4', 5)
         self.assertTrue(result)
-        self.assertEqual(ls.peers, {'R2':1, 'R3':1, 'R4':5})
+        self.assertEqual(ls.peers, {'R2': 1, 'R3': 1, 'R4': 5})
         result = ls.add_peer('R2', 1)
         self.assertFalse(result)
-        self.assertEqual(ls.peers, {'R2':1, 'R3':1, 'R4':5})
+        self.assertEqual(ls.peers, {'R2': 1, 'R3': 1, 'R4': 5})
 
         result = ls.del_peer('R3')
         self.assertTrue(result)
-        self.assertEqual(ls.peers, {'R2':1, 'R4':5})
+        self.assertEqual(ls.peers, {'R2': 1, 'R4': 5})
         result = ls.del_peer('R5')
         self.assertFalse(result)
-        self.assertEqual(ls.peers, {'R2':1, 'R4':5})
+        self.assertEqual(ls.peers, {'R2': 1, 'R4': 5})
 
         encoded = ls.to_dict()
         new_ls = LinkState(encoded)
         self.assertEqual(new_ls.id, 'R1')
         self.assertEqual(new_ls.ls_seq, 2)
-        self.assertEqual(new_ls.peers, {'R2':1, 'R4':5})
-
+        self.assertEqual(new_ls.peers, {'R2': 1, 'R4': 5})
 
     def test_hello_message(self):
         msg1 = MessageHELLO(None, 'R1', ['R2', 'R3', 'R4'])
@@ -159,7 +159,7 @@
             'helloIntervalSeconds'    :  1.0,
             'helloMaxAgeSeconds'      :  3.0,
             'raIntervalSeconds'       : 30.0,
-            'remoteLsMaxAgeSeconds'   : 60.0 })
+            'remoteLsMaxAgeSeconds'   : 60.0})
         self.neighbors = {}
 
     def test_hello_sent(self):
@@ -208,8 +208,7 @@
         self.engine.handle_hello(MessageHELLO(None, 'R5', ['R2']), 2.5, 0, 1)
         self.engine.handle_hello(MessageHELLO(None, 'R6', ['R1']), 2.5, 0, 1)
         self.engine.tick(3.0)
-        keys = [k for k in self.neighbors.keys()]
-        keys.sort()
+        keys = sorted([k for k in self.neighbors.keys()])
         self.assertEqual(keys, ['R2', 'R3', 'R4', 'R6'])
 
 
@@ -229,9 +228,9 @@
         +====+      +----+      +----+
 
         """
-        collection = { 'R1': LinkState(None, 'R1', 1, {'R2':1}),
-                       'R2': LinkState(None, 'R2', 1, {'R1':1, 'R3':1}),
-                       'R3': LinkState(None, 'R3', 1, {'R2':1}) }
+        collection = {'R1': LinkState(None, 'R1', 1, {'R2': 1}),
+                      'R2': LinkState(None, 'R2', 1, {'R1': 1, 'R3': 1}),
+                      'R3': LinkState(None, 'R3', 1, {'R2': 1})}
         next_hops, costs, valid_origins, radius = self.engine.calculate_routes(collection)
         self.assertEqual(len(next_hops), 2)
         self.assertEqual(next_hops['R2'], 'R2')
@@ -256,12 +255,12 @@
                     +----+      +----+      +----+
 
         """
-        collection = { 'R1': LinkState(None, 'R1', 1, {'R2':1}),
-                       'R2': LinkState(None, 'R2', 1, {'R1':1, 'R3':1, 'R4':1}),
-                       'R3': LinkState(None, 'R3', 1, {'R2':1, 'R5':1}),
-                       'R4': LinkState(None, 'R4', 1, {'R2':1, 'R5':1}),
-                       'R5': LinkState(None, 'R5', 1, {'R3':1, 'R4':1, 'R6':1}),
-                       'R6': LinkState(None, 'R6', 1, {'R5':1}) }
+        collection = {'R1': LinkState(None, 'R1', 1, {'R2': 1}),
+                      'R2': LinkState(None, 'R2', 1, {'R1': 1, 'R3': 1, 'R4': 1}),
+                      'R3': LinkState(None, 'R3', 1, {'R2': 1, 'R5': 1}),
+                      'R4': LinkState(None, 'R4', 1, {'R2': 1, 'R5': 1}),
+                      'R5': LinkState(None, 'R5', 1, {'R3': 1, 'R4': 1, 'R6': 1}),
+                      'R6': LinkState(None, 'R6', 1, {'R5': 1})}
         next_hops, costs, valid_origins, radius = self.engine.calculate_routes(collection)
         self.assertEqual(len(next_hops), 5)
         self.assertEqual(next_hops['R2'], 'R2')
@@ -295,12 +294,12 @@
                     +====+      +----+      +----+
 
         """
-        collection = { 'R2': LinkState(None, 'R2', 1, {'R3':1}),
-                       'R3': LinkState(None, 'R3', 1, {'R1':1, 'R2':1, 'R4':1}),
-                       'R4': LinkState(None, 'R4', 1, {'R3':1, 'R5':1}),
-                       'R1': LinkState(None, 'R1', 1, {'R3':1, 'R5':1}),
-                       'R5': LinkState(None, 'R5', 1, {'R1':1, 'R4':1, 'R6':1}),
-                       'R6': LinkState(None, 'R6', 1, {'R5':1}) }
+        collection = {'R2': LinkState(None, 'R2', 1, {'R3': 1}),
+                      'R3': LinkState(None, 'R3', 1, {'R1': 1, 'R2': 1, 'R4': 1}),
+                      'R4': LinkState(None, 'R4', 1, {'R3': 1, 'R5': 1}),
+                      'R1': LinkState(None, 'R1', 1, {'R3': 1, 'R5': 1}),
+                      'R5': LinkState(None, 'R5', 1, {'R1': 1, 'R4': 1, 'R6': 1}),
+                      'R6': LinkState(None, 'R6', 1, {'R5': 1})}
         next_hops, costs, valid_origins, radius = self.engine.calculate_routes(collection)
         self.assertEqual(len(next_hops), 5)
         self.assertEqual(next_hops['R2'], 'R3')
@@ -334,12 +333,12 @@
                     +====+      +----+      +----+
 
         """
-        collection = { 'R2': LinkState(None, 'R2', 1, {'R3':1}),
-                       'R3': LinkState(None, 'R3', 1, {'R1':1, 'R2':1, 'R4':1}),
-                       'R4': LinkState(None, 'R4', 1, {'R3':1, 'R5':1}),
-                       'R1': LinkState(None, 'R1', 1, {'R3':1, 'R5':1}),
-                       'R5': LinkState(None, 'R5', 1, {'R1':1, 'R4':1, 'R6':1}),
-                       'R6': LinkState(None, 'R6', 1, {'R5':1, 'R7':1}) }
+        collection = {'R2': LinkState(None, 'R2', 1, {'R3': 1}),
+                      'R3': LinkState(None, 'R3', 1, {'R1': 1, 'R2': 1, 'R4': 1}),
+                      'R4': LinkState(None, 'R4', 1, {'R3': 1, 'R5': 1}),
+                      'R1': LinkState(None, 'R1', 1, {'R3': 1, 'R5': 1}),
+                      'R5': LinkState(None, 'R5', 1, {'R1': 1, 'R4': 1, 'R6': 1}),
+                      'R6': LinkState(None, 'R6', 1, {'R5': 1, 'R7': 1})}
         next_hops, costs, valid_origins, radius = self.engine.calculate_routes(collection)
         self.assertEqual(len(next_hops), 6)
         self.assertEqual(next_hops['R2'], 'R3')
@@ -376,12 +375,12 @@
                     +====+      +----+      +----+
 
         """
-        collection = { 'R2': LinkState(None, 'R2', 1, {'R3':1, 'R1':1}),
-                       'R3': LinkState(None, 'R3', 1, {'R1':1, 'R2':1, 'R4':1}),
-                       'R4': LinkState(None, 'R4', 1, {'R3':1, 'R5':1}),
-                       'R1': LinkState(None, 'R1', 1, {'R3':1, 'R5':1, 'R2':1}),
-                       'R5': LinkState(None, 'R5', 1, {'R1':1, 'R4':1, 'R6':1}),
-                       'R6': LinkState(None, 'R6', 1, {'R5':1, 'R7':1}) }
+        collection = {'R2': LinkState(None, 'R2', 1, {'R3': 1, 'R1': 1}),
+                      'R3': LinkState(None, 'R3', 1, {'R1': 1, 'R2': 1, 'R4': 1}),
+                      'R4': LinkState(None, 'R4', 1, {'R3': 1, 'R5': 1}),
+                      'R1': LinkState(None, 'R1', 1, {'R3': 1, 'R5': 1, 'R2': 1}),
+                      'R5': LinkState(None, 'R5', 1, {'R1': 1, 'R4': 1, 'R6': 1}),
+                      'R6': LinkState(None, 'R6', 1, {'R5': 1, 'R7': 1})}
         next_hops, costs, valid_origins, radius = self.engine.calculate_routes(collection)
         self.assertEqual(len(next_hops), 6)
         self.assertEqual(next_hops['R2'], 'R2')
@@ -425,12 +424,12 @@
                     +====+      +----+      +----+
 
         """
-        collection = { 'R2': LinkState(None, 'R2', 1, {'R3':1}),
-                       'R3': LinkState(None, 'R3', 1, {'R1':1, 'R2':1, 'R4':1}),
-                       'R4': LinkState(None, 'R4', 1, {'R3':1, 'R5':1}),
-                       'R1': LinkState(None, 'R1', 1, {'R3':1, 'R5':1, 'R2':1}),
-                       'R5': LinkState(None, 'R5', 1, {'R1':1, 'R4':1, 'R6':1}),
-                       'R6': LinkState(None, 'R6', 1, {'R5':1, 'R7':1}) }
+        collection = {'R2': LinkState(None, 'R2', 1, {'R3': 1}),
+                      'R3': LinkState(None, 'R3', 1, {'R1': 1, 'R2': 1, 'R4': 1}),
+                      'R4': LinkState(None, 'R4', 1, {'R3': 1, 'R5': 1}),
+                      'R1': LinkState(None, 'R1', 1, {'R3': 1, 'R5': 1, 'R2': 1}),
+                      'R5': LinkState(None, 'R5', 1, {'R1': 1, 'R4': 1, 'R6': 1}),
+                      'R6': LinkState(None, 'R6', 1, {'R5': 1, 'R7': 1})}
         next_hops, costs, valid_origins, radius = self.engine.calculate_routes(collection)
         self.assertEqual(len(next_hops), 6)
         self.assertEqual(next_hops['R2'], 'R2')
@@ -467,12 +466,12 @@
                     +====+      +----+      +----+
 
         """
-        collection = { 'R2': LinkState(None, 'R2', 1, {'R3':1, 'R1':1}),
-                       'R3': LinkState(None, 'R3', 1, {'R1':1, 'R2':1, 'R4':1}),
-                       'R4': LinkState(None, 'R4', 1, {'R3':1, 'R5':1}),
-                       'R1': LinkState(None, 'R1', 1, {'R3':1, 'R5':1}),
-                       'R5': LinkState(None, 'R5', 1, {'R1':1, 'R4':1, 'R6':1}),
-                       'R6': LinkState(None, 'R6', 1, {'R5':1, 'R7':1}) }
+        collection = {'R2': LinkState(None, 'R2', 1, {'R3': 1, 'R1': 1}),
+                      'R3': LinkState(None, 'R3', 1, {'R1': 1, 'R2': 1, 'R4': 1}),
+                      'R4': LinkState(None, 'R4', 1, {'R3': 1, 'R5': 1}),
+                      'R1': LinkState(None, 'R1', 1, {'R3': 1, 'R5': 1}),
+                      'R5': LinkState(None, 'R5', 1, {'R1': 1, 'R4': 1, 'R6': 1}),
+                      'R6': LinkState(None, 'R6', 1, {'R5': 1, 'R7': 1})}
         next_hops, costs, valid_origins, radius = self.engine.calculate_routes(collection)
         self.assertEqual(len(next_hops), 6)
         self.assertEqual(next_hops['R2'], 'R3')
@@ -509,12 +508,12 @@
                     +====+      +----+      +----+
 
         """
-        collection = { 'R2': LinkState(None, 'R2', 1, {'R3':1, 'R1':1}),
-                       'R3': LinkState(None, 'R3', 1, {'R1':1, 'R2':1, 'R4':1}),
-                       'R4': LinkState(None, 'R4', 1, {'R3':1, 'R5':1}),
-                       'R1': LinkState(None, 'R1', 1, {'R3':1, 'R5':1}),
-                       'R5': LinkState(None, 'R5', 1, {'R1':1, 'R4':1}),
-                       'R6': LinkState(None, 'R6', 1, {'R5':1, 'R7':1}) }
+        collection = {'R2': LinkState(None, 'R2', 1, {'R3': 1, 'R1': 1}),
+                      'R3': LinkState(None, 'R3', 1, {'R1': 1, 'R2': 1, 'R4': 1}),
+                      'R4': LinkState(None, 'R4', 1, {'R3': 1, 'R5': 1}),
+                      'R1': LinkState(None, 'R1', 1, {'R3': 1, 'R5': 1}),
+                      'R5': LinkState(None, 'R5', 1, {'R1': 1, 'R4': 1}),
+                      'R6': LinkState(None, 'R6', 1, {'R5': 1, 'R7': 1})}
         next_hops, costs, valid_origins, radius = self.engine.calculate_routes(collection)
         self.assertEqual(len(next_hops), 4)
         self.assertEqual(next_hops['R2'], 'R3')
@@ -547,12 +546,12 @@
                     +====+      +----+      +----+
 
         """
-        collection = { 'R2': LinkState(None, 'R2', 1, {'R3':4,  'R1':20}),
-                       'R3': LinkState(None, 'R3', 1, {'R1':3,  'R2':4,  'R4':4}),
-                       'R4': LinkState(None, 'R4', 1, {'R3':4,  'R5':5}),
-                       'R1': LinkState(None, 'R1', 1, {'R3':3,  'R5':10, 'R2':20}),
-                       'R5': LinkState(None, 'R5', 1, {'R1':10, 'R4':5,  'R6':2}),
-                       'R6': LinkState(None, 'R6', 1, {'R5':2,  'R7':1}) }
+        collection = {'R2': LinkState(None, 'R2', 1, {'R3': 4,  'R1': 20}),
+                      'R3': LinkState(None, 'R3', 1, {'R1': 3,  'R2': 4,  'R4': 4}),
+                      'R4': LinkState(None, 'R4', 1, {'R3': 4,  'R5': 5}),
+                      'R1': LinkState(None, 'R1', 1, {'R3': 3,  'R5': 10, 'R2': 20}),
+                      'R5': LinkState(None, 'R5', 1, {'R1': 10, 'R4': 5,  'R6': 2}),
+                      'R6': LinkState(None, 'R6', 1, {'R5': 2,  'R7': 1})}
         next_hops, costs, valid_origins, radius = self.engine.calculate_routes(collection)
         self.assertEqual(len(next_hops), 6)
         self.assertEqual(next_hops['R2'], 'R3')
@@ -598,12 +597,12 @@
                     +====+      +----+      +----+
 
         """
-        collection = { 'R2': LinkState(None, 'R2', 1, {'R3':4,   'R1':5}),
-                       'R3': LinkState(None, 'R3', 1, {'R1':100, 'R2':4,   'R4':4}),
-                       'R4': LinkState(None, 'R4', 1, {'R3':4,   'R5':100}),
-                       'R1': LinkState(None, 'R1', 1, {'R3':100, 'R5':10,  'R2':5}),
-                       'R5': LinkState(None, 'R5', 1, {'R1':10,  'R4':100, 'R6':2}),
-                       'R6': LinkState(None, 'R6', 1, {'R5':2,   'R7':1}) }
+        collection = {'R2': LinkState(None, 'R2', 1, {'R3': 4,   'R1': 5}),
+                      'R3': LinkState(None, 'R3', 1, {'R1': 100, 'R2': 4,   'R4': 4}),
+                      'R4': LinkState(None, 'R4', 1, {'R3': 4,   'R5': 100}),
+                      'R1': LinkState(None, 'R1', 1, {'R3': 100, 'R5': 10,  'R2': 5}),
+                      'R5': LinkState(None, 'R5', 1, {'R1': 10,  'R4': 100, 'R6': 2}),
+                      'R6': LinkState(None, 'R6', 1, {'R5': 2,   'R7': 1})}
         next_hops, costs, valid_origins, radius = self.engine.calculate_routes(collection)
         self.assertEqual(len(next_hops), 6)
         self.assertEqual(next_hops['R2'], 'R2')
@@ -649,12 +648,12 @@
         +----+      +----+      +----+
 
         """
-        collection = { 'R1': LinkState(None, 'R1', 1, {'R2':1,  'R3':10}),
-                       'R2': LinkState(None, 'R2', 1, {'R1':1,  'R4':10}),
-                       'R3': LinkState(None, 'R3', 1, {'R1':10, 'R4':10, 'R5':10}),
-                       'R4': LinkState(None, 'R4', 1, {'R2':10, 'R3':10, 'R6':10}),
-                       'R5': LinkState(None, 'R5', 1, {'R3':10, 'R6':1}),
-                       'R6': LinkState(None, 'R6', 1, {'R4':10, 'R5':1}) }
+        collection = {'R1': LinkState(None, 'R1', 1, {'R2': 1,  'R3': 10}),
+                      'R2': LinkState(None, 'R2', 1, {'R1': 1,  'R4': 10}),
+                      'R3': LinkState(None, 'R3', 1, {'R1': 10, 'R4': 10, 'R5': 10}),
+                      'R4': LinkState(None, 'R4', 1, {'R2': 10, 'R3': 10, 'R6': 10}),
+                      'R5': LinkState(None, 'R5', 1, {'R3': 10, 'R6': 1}),
+                      'R6': LinkState(None, 'R6', 1, {'R4': 10, 'R5': 1})}
 
         self.id = 'R3'
         self.engine = PathEngine(self)
diff --git a/tests/router_policy_test.py b/tests/router_policy_test.py
index 3ed78d4..f4003f3 100644
--- a/tests/router_policy_test.py
+++ b/tests/router_policy_test.py
@@ -34,6 +34,7 @@
 from qpid_dispatch_internal.policy.policy_local import PolicyLocal
 from system_test import TestCase, main_module
 
+
 class PolicyHostAddrTest(TestCase):
 
     def expect_deny(self, badhostname, msg):
@@ -49,11 +50,11 @@
         # check that the internal struct version matches, too
         ha = HostStruct(tString)
         if expectOk:
-            self.assertTrue( tHostAddr.match_str(tString) )
-            self.assertTrue( tHostAddr.match_bin(ha) )
+            self.assertTrue(tHostAddr.match_str(tString))
+            self.assertTrue(tHostAddr.match_bin(ha))
         else:
-            self.assertFalse( tHostAddr.match_str(tString) )
-            self.assertFalse( tHostAddr.match_bin(ha) )
+            self.assertFalse(tHostAddr.match_str(tString))
+            self.assertFalse(tHostAddr.match_bin(ha))
 
     def test_policy_hostaddr_ipv4(self):
         # Create simple host and range
@@ -90,30 +91,30 @@
 
     def test_policy_hostaddr_ipv4_wildcard(self):
         aaa = HostAddr("*")
-        self.check_hostaddr_match(aaa,"0.0.0.0")
-        self.check_hostaddr_match(aaa,"127.0.0.1")
-        self.check_hostaddr_match(aaa,"255.254.253.252")
-
+        self.check_hostaddr_match(aaa, "0.0.0.0")
+        self.check_hostaddr_match(aaa, "127.0.0.1")
+        self.check_hostaddr_match(aaa, "255.254.253.252")
 
     def test_policy_hostaddr_ipv6_wildcard(self):
         if not is_ipv6_enabled():
             self.skipTest("System IPv6 support is not available")
         aaa = HostAddr("*")
-        self.check_hostaddr_match(aaa,"::0")
-        self.check_hostaddr_match(aaa,"::1")
-        self.check_hostaddr_match(aaa,"ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff")
+        self.check_hostaddr_match(aaa, "::0")
+        self.check_hostaddr_match(aaa, "::1")
+        self.check_hostaddr_match(aaa, "ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff")
 
     def test_policy_malformed_hostaddr_ipv4(self):
-        self.expect_deny( "0.0.0.0.0", "Name or service not known")
-        self.expect_deny( "1.1.1.1,2.2.2.2,3.3.3.3", "arg count")
-        self.expect_deny( "9.9.9.9,8.8.8.8", "a > b")
+        self.expect_deny("0.0.0.0.0", "Name or service not known")
+        self.expect_deny("1.1.1.1,2.2.2.2,3.3.3.3", "arg count")
+        self.expect_deny("9.9.9.9,8.8.8.8", "a > b")
 
     def test_policy_malformed_hostaddr_ipv6(self):
         if not is_ipv6_enabled():
             self.skipTest("System IPv6 support is not available")
-        self.expect_deny( "1::2::3", "Name or service not known")
-        self.expect_deny( "::1,::2,::3", "arg count")
-        self.expect_deny( "0:ff:0,0:fe:ffff:ffff::0", "a > b")
+        self.expect_deny("1::2::3", "Name or service not known")
+        self.expect_deny("::1,::2,::3", "arg count")
+        self.expect_deny("0:ff:0,0:fe:ffff:ffff::0", "a > b")
+
 
 class QpidDispatch(object):
     def qd_dispatch_policy_c_counts_alloc(self):
@@ -122,6 +123,7 @@
     def qd_dispatch_policy_c_counts_refresh(self, cstats, entitymap):
         pass
 
+
 class MockAgent(object):
     def __init__(self):
         self.qd = QpidDispatch()
@@ -129,6 +131,7 @@
     def add_implementation(self, entity, cfg_obj_name):
         pass
 
+
 class MockPolicyManager(object):
     def __init__(self):
         self.agent = MockAgent()
@@ -157,6 +160,7 @@
     def get_agent(self):
         return self.agent
 
+
 class PolicyFile(TestCase):
 
     manager = MockPolicyManager()
@@ -191,12 +195,12 @@
 
     def test_policy1_test_zeke_bad_app(self):
         self.assertTrue(
-            PolicyFile.policy.lookup_user('zeke', '192.168.100.5','galleria', "connid", 5) == '')
+            PolicyFile.policy.lookup_user('zeke', '192.168.100.5', 'galleria', "connid", 5) == '')
 
     def test_policy1_test_users_same_permissions(self):
         zname = PolicyFile.policy.lookup_user('zeke', '192.168.100.5', 'photoserver', '192.168.100.5:33333', 6)
         yname = PolicyFile.policy.lookup_user('ynot', '10.48.255.254', 'photoserver', '192.168.100.5:33334', 7)
-        self.assertTrue( zname == yname )
+        self.assertTrue(zname == yname)
 
     def test_policy1_lookup_unknown_application(self):
         upolicy = {}
@@ -210,6 +214,7 @@
             PolicyFile.policy.lookup_settings('photoserver', 'unknown', upolicy)
         )
 
+
 class PolicyFileApplicationFallback(TestCase):
     manager = MockPolicyManager()
     policy = PolicyLocal(manager)
@@ -246,6 +251,7 @@
         self.assertTrue(
             self.policy.lookup_user('zeke', '192.168.100.5', 'galleria', "connid", 5) == '')
 
+
 class PolicyAppConnectionMgrTests(TestCase):
 
     def test_policy_app_conn_mgr_fail_by_total(self):
@@ -350,7 +356,7 @@
 
     #
     def test_AliasesRenameOwnVhost(self):
-        config_str="""
+        config_str = """
 [{
   "hostname": "$default",
   "allowUnknownUser": true,
@@ -379,7 +385,7 @@
 
     #
     def test_SameAliasOnTwoVhosts(self):
-        config_str="""
+        config_str = """
 [{
   "hostname": "$default",
   "aliases": "a,b,c,d,e",
@@ -412,7 +418,7 @@
 
     #
     def test_AliasConflictsWithVhost(self):
-        config_str="""
+        config_str = """
 [{
   "hostname": "$default",
   "groups": {
diff --git a/tests/run_system_tests.py b/tests/run_system_tests.py
index fe032c2..6bb1fa7 100644
--- a/tests/run_system_tests.py
+++ b/tests/run_system_tests.py
@@ -38,7 +38,7 @@
 # Collect all system_tests_*.py scripts in the same directory as this script.
 test_modules = [os.path.splitext(f)[0] for f in os.listdir(system_test.DIR)
                 if fnmatch(f, "system_tests_*.py")]
-sys.path = [system_test.DIR] + sys.path # Find test modules in sys.path
+sys.path = [system_test.DIR] + sys.path  # Find test modules in sys.path
 
 # python < 2.7 unittest main won't load tests from modules, so use the loader:
 all_tests = unittest.TestSuite()
diff --git a/tests/system_test.py b/tests/system_test.py
index 58f680c..ea98293 100755
--- a/tests/system_test.py
+++ b/tests/system_test.py
@@ -33,7 +33,17 @@
 from __future__ import absolute_import
 from __future__ import print_function
 
-import errno, os, time, socket, random, subprocess, shutil, unittest, __main__, re, sys
+import errno
+import os
+import time
+import socket
+import random
+import subprocess
+import shutil
+import unittest
+import __main__
+import re
+import sys
 import functools
 from datetime import datetime
 from subprocess import PIPE, STDOUT
@@ -96,20 +106,24 @@
                 return exe_file
     return None
 
+
 # The directory where this module lives. Used to locate static configuration files etc.
 DIR = os.path.dirname(__file__)
 
+
 def _check_requirements():
     """If requirements are missing, return a message, else return empty string."""
     missing = MISSING_MODULES
     required_exes = ['qdrouterd']
-    missing += ["No exectuable %s"%e for e in required_exes if not find_exe(e)]
+    missing += ["No exectuable %s" % e for e in required_exes if not find_exe(e)]
 
     if missing:
-        return "%s: %s"%(__name__, ", ".join(missing))
+        return "%s: %s" % (__name__, ", ".join(missing))
+
 
 MISSING_REQUIREMENTS = _check_requirements()
 
+
 def retry_delay(deadline, delay, max_delay):
     """For internal use in retry. Sleep as required
     and return the new delay or None if retry should time out"""
@@ -117,12 +131,14 @@
     if remaining <= 0:
         return None
     time.sleep(min(delay, remaining))
-    return min(delay*2, max_delay)
+    return min(delay * 2, max_delay)
+
 
 # Valgrind significantly slows down the response time of the router, so use a
 # long default timeout
 TIMEOUT = float(os.environ.get("QPID_SYSTEM_TEST_TIMEOUT", 60))
 
+
 def retry(function, timeout=TIMEOUT, delay=.001, max_delay=1):
     """Call function until it returns a true value or timeout expires.
     Double the delay for each retry up to max_delay.
@@ -138,6 +154,7 @@
             if delay is None:
                 return None
 
+
 def retry_exception(function, timeout=TIMEOUT, delay=.001, max_delay=1, exception_test=None):
     """Call function until it returns without exception or timeout expires.
     Double the delay for each retry up to max_delay.
@@ -157,6 +174,7 @@
             if delay is None:
                 raise
 
+
 def get_local_host_socket(protocol_family='IPv4'):
     if protocol_family == 'IPv4':
         s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
@@ -167,6 +185,7 @@
 
     return s, host
 
+
 def port_available(port, protocol_family='IPv4'):
     """Return true if connecting to host:port gives 'connection refused'."""
     s, host = get_local_host_socket(protocol_family)
@@ -181,6 +200,7 @@
     s.close()
     return available
 
+
 def wait_port(port, protocol_family='IPv4', **retry_kwargs):
     """Wait up to timeout for port (on host) to be connectable.
     Takes same keyword arguments as retry to control the timeout"""
@@ -205,12 +225,14 @@
     except Exception as e:
         raise Exception("wait_port timeout on host %s port %s: %s" % (host, port, e))
 
+
 def wait_ports(ports, **retry_kwargs):
     """Wait up to timeout for all ports (on host) to be connectable.
     Takes same keyword arguments as retry to control the timeout"""
     for port, protocol_family in dict_iteritems(ports):
         wait_port(port=port, protocol_family=protocol_family, **retry_kwargs)
 
+
 def message(**properties):
     """Convenience to create a proton.Message with properties set"""
     m = Message()
@@ -231,6 +253,7 @@
     EXIT_FAIL = 1               # Exit status 1
 
     unique_id = 0
+
     @classmethod
     def unique(cls, name):
         cls.unique_id += 1
@@ -277,16 +300,16 @@
             with open(self.outfile + '.out') as f:
                 raise RuntimeError("Process %s error: %s\n%s\n%s\n>>>>\n%s<<<<" % (
                     self.pid, msg, ' '.join(self.args),
-                    self.outfile + '.cmd', f.read()));
+                    self.outfile + '.cmd', f.read()))
 
         status = self.poll()
         if status is None:      # Still running
             self.terminate()
-            if self.expect != None and  self.expect != Process.RUNNING:
+            if self.expect is not None and self.expect != Process.RUNNING:
                 error("still running")
             self.expect = 0     # Expect clean exit after terminate
             status = self.wait()
-        if self.expect != None and self.expect != status:
+        if self.expect is not None and self.expect != status:
             error("exit code %s, expected %s" % (status, self.expect))
 
     def wait(self, timeout=None):
@@ -329,7 +352,7 @@
 
     def write(self, name, suffix=".conf"):
         """Write the config object to file name.suffix. Returns name.suffix."""
-        name = name+suffix
+        name = name + suffix
         with open(name, 'w') as f:
             f.write(str(self))
         return name
@@ -340,6 +363,8 @@
         super(HttpServer, self).__init__(args, name=name, expect=expect)
 
 # A HTTP2 Server that will respond to requests made via the router
+
+
 class Http2Server(HttpServer):
     def __init__(self, name=None, listen_port=None, wait=True,
                  py_string='python3', perform_teardown=True, cl_args=None,
@@ -401,9 +426,9 @@
         """
 
         DEFAULTS = {
-            'listener': {'host':'0.0.0.0', 'saslMechanisms':'ANONYMOUS', 'idleTimeoutSeconds': '120',
+            'listener': {'host': '0.0.0.0', 'saslMechanisms': 'ANONYMOUS', 'idleTimeoutSeconds': '120',
                          'authenticatePeer': 'no', 'role': 'normal'},
-            'connector': {'host':'127.0.0.1', 'saslMechanisms':'ANONYMOUS', 'idleTimeoutSeconds': '120'},
+            'connector': {'host': '127.0.0.1', 'saslMechanisms': 'ANONYMOUS', 'idleTimeoutSeconds': '120'},
             'router': {'mode': 'standalone', 'id': 'QDR'}
         }
 
@@ -418,8 +443,8 @@
             """Fill in default values in gconfiguration"""
             for name, props in self:
                 if name in Qdrouterd.Config.DEFAULTS:
-                    for n,p in dict_iteritems(Qdrouterd.Config.DEFAULTS[name]):
-                        props.setdefault(n,p)
+                    for n, p in dict_iteritems(Qdrouterd.Config.DEFAULTS[name]):
+                        props.setdefault(n, p)
 
         def __str__(self):
             """Generate config file content. Calls default() first."""
@@ -434,7 +459,7 @@
                     result += "".join(["%s%s: %s,\n" % (tabs(level + 1),
                                                         json.dumps(k),
                                                         json.dumps(v))
-                                       for k,v in item.items()])
+                                       for k, v in item.items()])
                     result += "%s}" % tabs(level)
                     return result
                 return "%s" %  item
@@ -450,7 +475,7 @@
 
             self.defaults()
             # top level list of tuples ('section-name', dict)
-            return "".join(["%s {\n%s}\n"%(n, attributes(p, 1)) for n, p in self])
+            return "".join(["%s {\n%s}\n" % (n, attributes(p, 1)) for n, p in self])
 
     def __init__(self, name=None, config=Config(), pyinclude=None, wait=True,
                  perform_teardown=True, cl_args=None, expect=Process.RUNNING):
@@ -462,7 +487,8 @@
         cl_args = cl_args or []
         self.config = copy(config)
         self.perform_teardown = perform_teardown
-        if not name: name = self.config.router_id
+        if not name:
+            name = self.config.router_id
         assert name
         # setup log and debug dump files
         self.dumpfile = os.path.abspath('%s-qddebug.txt' % name)
@@ -471,7 +497,7 @@
         if not default_log:
             self.logfile = "%s.log" % name
             config.append(
-                ('log', {'module':'DEFAULT', 'enable':'trace+',
+                ('log', {'module': 'DEFAULT', 'enable': 'trace+',
                          'includeSource': 'true', 'outputFile': self.logfile}))
         else:
             self.logfile = default_log[0][1].get('outputfile')
@@ -500,7 +526,8 @@
         if self._management:
             try:
                 self._management.close()
-            except: pass
+            except:
+                pass
             self._management = None
 
         if not self.perform_teardown:
@@ -559,7 +586,7 @@
                                      self.config.router_id)
                     tail = tail_file(os.path.join(self.outdir, self.logfile))
                     for ln in tail:
-                        sys.stderr.write("%s" % ln);
+                        sys.stderr.write("%s" % ln)
                     sys.stderr.write("\n<<<<\n")
                 sys.stderr.flush()
             except OSError:
@@ -668,6 +695,7 @@
         Block until address has no subscribers
         """
         a_type = 'org.apache.qpid.dispatch.router.address'
+
         def check():
             addrs = self.management.query(a_type).get_dicts()
             rc = list(filter(lambda a: a['name'].find(address) != -1,
@@ -741,7 +769,7 @@
     top_dir = os.getcwd()
 
     # The root directory for Tester directories, under top_dir
-    root_dir = os.path.abspath(__name__+'.dir')
+    root_dir = os.path.abspath(__name__ + '.dir')
 
     def __init__(self, id):
         """
@@ -842,9 +870,9 @@
         Tester.teardown(self)
 
     def assert_fair(self, seq):
-        avg = sum(seq)/len(seq)
+        avg = sum(seq) / len(seq)
         for i in seq:
-            assert i > avg/2, "Work not fairly distributed: %s"%seq
+            assert i > avg / 2, "Work not fairly distributed: %s" % seq
 
     if not hasattr(unittest.TestCase, 'assertRegex'):
         def assertRegex(self, text, regexp, msg=None):
@@ -871,6 +899,7 @@
     condition must be provided (skip parameter) to define whether
     or not the test will be skipped.
     """
+
     def __init__(self, skip, reason):
         """
         :param skip: if True the method wont be called
@@ -972,6 +1001,7 @@
         kwargs = {'source': self.source}
         rcv = event.container.create_receiver(event.connection,
                                               **kwargs)
+
     def on_link_opened(self, event):
         self._ready.set()
 
@@ -1076,7 +1106,7 @@
             self._conn = None
 
     def on_accepted(self, event):
-        self.accepted += 1;
+        self.accepted += 1
         event.delivery.settle()
 
     def on_released(self, event):
@@ -1109,10 +1139,12 @@
             self._conn.close()
             self._conn = None
 
+
 class QdManager(object):
     """
     A means to invoke qdmanage during a testcase
     """
+
     def __init__(self, tester=None, address=None, timeout=TIMEOUT,
                  router_id=None,
                  edge_router_id=None):
@@ -1135,8 +1167,8 @@
         p = self._tester.popen(
             ['qdmanage'] + cmd.split(' ')
             + self.router + ['--bus', address or self._address,
-               '--indent=-1',
-               '--timeout', str(timeout or self._timeout)],
+                             '--indent=-1',
+                             '--timeout', str(timeout or self._timeout)],
             stdin=PIPE, stdout=PIPE, stderr=STDOUT, expect=expect,
             universal_newlines=True)
         out = p.communicate(input)[0]
@@ -1205,7 +1237,6 @@
         def __getattr__(self, key):
             return self.attrs[key]
 
-
     def __init__(self, reply_addr):
         self.reply_addr = reply_addr
 
@@ -1291,6 +1322,7 @@
     A callback object for MessagingHandler class
     parent: A MessagingHandler with a timeout() method
     """
+
     def __init__(self, parent):
         self.parent = parent
 
@@ -1303,6 +1335,7 @@
     A callback object for MessagingHandler scheduled timers
     parent: A MessagingHandler with a poll_timeout() method
     """
+
     def __init__(self, parent):
         self.parent = parent
 
@@ -1321,6 +1354,7 @@
             return item
     return None
 
+
 def has_mobile_dest_in_address_table(address, dest):
     qdm = QdManager(address=address)
     rc = qdm.query('org.apache.qpid.dispatch.router.address')
@@ -1351,6 +1385,7 @@
     """
     Time stamps for logging.
     """
+
     def __init__(self):
         self.ts = datetime.now()
 
@@ -1373,7 +1408,7 @@
     def log(self, msg):
         ts = Timestamp()
         if self.save_for_dump:
-            self.logs.append( (ts, msg) )
+            self.logs.append((ts, msg))
         if self.print_to_console:
             print("%s %s" % (ts, msg))
             sys.stdout.flush()
diff --git a/tests/system_tests_address_lookup.py b/tests/system_tests_address_lookup.py
index 01a7745..3a717a3 100644
--- a/tests/system_tests_address_lookup.py
+++ b/tests/system_tests_address_lookup.py
@@ -121,7 +121,7 @@
                    ('linkRoute', {'pattern': 'org.apache.B.#',
                                   'containerId': 'FakeBrokerB',
                                   'direction': 'out'})
-                ])
+               ])
         cls.INT_B = cls.routers[-1]
         cls.INT_B.edge_listener = cls.INT_B.addresses[1]
         cls.INT_B.broker_connector = cls.INT_B.connector_addresses[1]
diff --git a/tests/system_tests_auth_service_plugin.py b/tests/system_tests_auth_service_plugin.py
index 2fe4000..b3c0809 100644
--- a/tests/system_tests_auth_service_plugin.py
+++ b/tests/system_tests_auth_service_plugin.py
@@ -72,20 +72,20 @@
         print('launching auth service...')
         auth_service_port = cls.tester.get_port()
         cls.tester.qdrouterd('auth_service', Qdrouterd.Config([
-                     ('listener', {'host': '0.0.0.0', 'role': 'normal', 'port': auth_service_port,
-                                   'saslMechanisms':'PLAIN', 'authenticatePeer': 'yes'}),
-                     ('router', {'workerThreads': 1,
-                                 'id': 'auth_service',
-                                 'mode': 'standalone',
-                                 'saslConfigName': 'tests-mech-PLAIN',
-                                 'saslConfigPath': os.getcwd()})
+            ('listener', {'host': '0.0.0.0', 'role': 'normal', 'port': auth_service_port,
+                          'saslMechanisms': 'PLAIN', 'authenticatePeer': 'yes'}),
+            ('router', {'workerThreads': 1,
+                        'id': 'auth_service',
+                        'mode': 'standalone',
+                        'saslConfigName': 'tests-mech-PLAIN',
+                        'saslConfigPath': os.getcwd()})
         ])).wait_ready()
 
         cls.router_port = cls.tester.get_port()
         cls.tester.qdrouterd('router', Qdrouterd.Config([
-                     ('authServicePlugin', {'name':'myauth', 'host': '127.0.0.1', 'port': auth_service_port}),
-                     ('listener', {'host': '0.0.0.0', 'port': cls.router_port, 'role': 'normal', 'saslPlugin':'myauth', 'saslMechanisms':'PLAIN'}),
-                     ('router', {'mode': 'standalone', 'id': 'router'})
+            ('authServicePlugin', {'name': 'myauth', 'host': '127.0.0.1', 'port': auth_service_port}),
+            ('listener', {'host': '0.0.0.0', 'port': cls.router_port, 'role': 'normal', 'saslPlugin': 'myauth', 'saslMechanisms': 'PLAIN'}),
+            ('router', {'mode': 'standalone', 'id': 'router'})
         ])).wait_ready()
 
     @SkipIfNeeded(not SASL.extended(), "Cyrus library not available. skipping test")
@@ -132,21 +132,21 @@
         print('launching auth service...')
         auth_service_port = cls.tester.get_port()
         cls.tester.qdrouterd('auth_service', Qdrouterd.Config([
-                     ('listener', {'host': '0.0.0.0', 'role': 'normal', 'port': auth_service_port,
-                                   'saslMechanisms':'PLAIN', 'authenticatePeer': 'yes'}),
-                     ('router', {'workerThreads': 1,
-                                 'id': 'auth_service',
-                                 'mode': 'standalone',
-                                 'saslConfigName': 'tests-mech-PLAIN',
-                                 'saslConfigPath': os.getcwd()})
+            ('listener', {'host': '0.0.0.0', 'role': 'normal', 'port': auth_service_port,
+                          'saslMechanisms': 'PLAIN', 'authenticatePeer': 'yes'}),
+            ('router', {'workerThreads': 1,
+                        'id': 'auth_service',
+                        'mode': 'standalone',
+                        'saslConfigName': 'tests-mech-PLAIN',
+                        'saslConfigPath': os.getcwd()})
         ])).wait_ready()
 
         cls.router_port = cls.tester.get_port()
         cls.tester.qdrouterd('router', Qdrouterd.Config([
-                     ('authServicePlugin', {'name':'myauth', 'authService': '127.0.0.1:%d' % auth_service_port}),
-                     ('listener', {'host': '0.0.0.0', 'port': cls.router_port, 'role': 'normal',
-                                   'saslPlugin':'myauth', 'saslMechanisms':'PLAIN'}),
-                     ('router', {'mode': 'standalone', 'id': 'router'})
+            ('authServicePlugin', {'name': 'myauth', 'authService': '127.0.0.1:%d' % auth_service_port}),
+            ('listener', {'host': '0.0.0.0', 'port': cls.router_port, 'role': 'normal',
+                          'saslPlugin': 'myauth', 'saslMechanisms': 'PLAIN'}),
+            ('router', {'mode': 'standalone', 'id': 'router'})
         ])).wait_ready()
 
 
@@ -181,4 +181,3 @@
 
 if __name__ == '__main__':
     unittest.main(main_module())
-
diff --git a/tests/system_tests_authz_service_plugin.py.in b/tests/system_tests_authz_service_plugin.py.in
index 04d0ac9..0b33781 100644
--- a/tests/system_tests_authz_service_plugin.py.in
+++ b/tests/system_tests_authz_service_plugin.py.in
@@ -22,7 +22,8 @@
 from __future__ import absolute_import
 from __future__ import print_function
 
-import os, json
+import os
+import json
 from subprocess import PIPE, Popen, STDOUT
 from system_test import TestCase, Qdrouterd, main_module, DIR, Process, SkipIfNeeded
 from system_test import unittest
@@ -57,7 +58,6 @@
 mech_list: SCRAM-SHA-1 PLAIN
 """)
 
-
     @classmethod
     def setUpClass(cls):
         """
@@ -71,21 +71,22 @@
         cls.createSaslFiles()
 
         cls.auth_service_port = cls.tester.get_port()
-        cls.tester.popen(['/usr/bin/env', '${PY_STRING}', os.path.join(os.path.dirname(os.path.abspath(__file__)), 'authservice.py'), '-a', 'amqps://127.0.0.1:%d' % cls.auth_service_port, '-c', os.getcwd()], expect=Process.RUNNING)
+        cls.tester.popen(['/usr/bin/env', '${PY_STRING}', os.path.join(os.path.dirname(os.path.abspath(__file__)), 'authservice.py'),
+                          '-a', 'amqps://127.0.0.1:%d' % cls.auth_service_port, '-c', os.getcwd()], expect=Process.RUNNING)
 
         policy_config_path = os.path.join(DIR, 'policy-authz')
 
         cls.router_port = cls.tester.get_port()
         cls.tester.qdrouterd('router', Qdrouterd.Config([
-                     ('sslProfile', {'name':'myssl'}),
-                     ('policy', {'maxConnections': 2, 'policyDir': policy_config_path, 'enableVhostPolicy': 'true'}),
-                     # authService attribute has been deprecated. We are using it here to make sure that we are
-                     # still backward compatible.
-                     ('authServicePlugin', {'name':'myauth', 'sslProfile':'myssl', 'port': cls.auth_service_port, 'host': '127.0.0.1'}),
-                     ('listener', {'host': '0.0.0.0', 'port': cls.router_port, 'role': 'normal', 'saslPlugin':'myauth', 'saslMechanisms':'SCRAM-SHA-1 PLAIN'}),
-                     ('router', {'mode': 'standalone', 'id': 'router',
-                                 'saslConfigName': 'tests-mech-SCRAM',
-                                 'saslConfigPath': os.getcwd()})
+            ('sslProfile', {'name': 'myssl'}),
+            ('policy', {'maxConnections': 2, 'policyDir': policy_config_path, 'enableVhostPolicy': 'true'}),
+            # authService attribute has been deprecated. We are using it here to make sure that we are
+            # still backward compatible.
+            ('authServicePlugin', {'name': 'myauth', 'sslProfile': 'myssl', 'port': cls.auth_service_port, 'host': '127.0.0.1'}),
+            ('listener', {'host': '0.0.0.0', 'port': cls.router_port, 'role': 'normal', 'saslPlugin': 'myauth', 'saslMechanisms': 'SCRAM-SHA-1 PLAIN'}),
+            ('router', {'mode': 'standalone', 'id': 'router',
+                        'saslConfigName': 'tests-mech-SCRAM',
+                        'saslConfigPath': os.getcwd()})
         ])).wait_ready()
 
     @SkipIfNeeded(not SASL.extended(), "Cyrus library not available. skipping test")
@@ -155,19 +156,22 @@
         cls.createSaslFiles()
 
         cls.auth_service_port = cls.tester.get_port()
-        cls.tester.popen(['/usr/bin/env', '${PY_STRING}', os.path.join(os.path.dirname(os.path.abspath(__file__)), 'authservice.py'), '-a', 'amqps://127.0.0.1:%d' % cls.auth_service_port, '-c', os.getcwd()], expect=Process.RUNNING)
+        cls.tester.popen(['/usr/bin/env', '${PY_STRING}', os.path.join(os.path.dirname(os.path.abspath(__file__)), 'authservice.py'),
+                          '-a', 'amqps://127.0.0.1:%d' % cls.auth_service_port, '-c', os.getcwd()], expect=Process.RUNNING)
 
         cls.router_port = cls.tester.get_port()
         cls.tester.qdrouterd('router', Qdrouterd.Config([
-                     ('sslProfile', {'name':'myssl'}),
-                     # authService and authSslProfile attributea have been deprecated.
-                     # We are using it here to make sure that we are backward compatible.
-                     ('authServicePlugin', {'name':'myauth', 'authSslProfile':'myssl', 'authService': '127.0.0.1:%d' % cls.auth_service_port}),
-                     ('listener', {'host': '0.0.0.0', 'port': cls.router_port, 'role': 'normal', 'saslPlugin':'myauth', 'saslMechanisms':'SCRAM-SHA-1 PLAIN'}),
-                     ('router', {'mode': 'standalone', 'id': 'router',
-                                 'saslConfigName': 'tests-mech-SCRAM',
-                                 'saslConfigPath': os.getcwd()})
+            ('sslProfile', {'name': 'myssl'}),
+            # authService and authSslProfile attributea have been deprecated.
+            # We are using it here to make sure that we are backward compatible.
+            ('authServicePlugin', {'name': 'myauth', 'authSslProfile': 'myssl', 'authService': '127.0.0.1:%d' % cls.auth_service_port}),
+            ('listener', {'host': '0.0.0.0', 'port': cls.router_port, 'role': 'normal', 'saslPlugin': 'myauth', 'saslMechanisms': 'SCRAM-SHA-1 PLAIN'}),
+            ('router', {'mode': 'standalone', 'id': 'router',
+                        'saslConfigName': 'tests-mech-SCRAM',
+                        'saslConfigPath': os.getcwd()})
         ])).wait_ready()
+
+
 class ConnectionHandler(MessagingHandler):
     def __init__(self, address, count):
         super(ConnectionHandler, self).__init__()
@@ -185,7 +189,7 @@
     def on_sendable(self, event):
         if self.sent < self.count:
             self.sent += 1
-            event.sender.send(Message(body='msg-%s' %self.sent))
+            event.sender.send(Message(body='msg-%s' % self.sent))
 
     def on_link_error(self, event):
         self.errors.append(event.link.remote_condition.name)
@@ -195,6 +199,7 @@
         event.container.create_receiver(event.connection, self.address)
         event.container.create_sender(event.connection, self.address)
 
+
 class DynamicSourceAnonymousSender(MessagingHandler):
     def __init__(self):
         super(DynamicSourceAnonymousSender, self).__init__()
@@ -205,7 +210,7 @@
         self.errors = []
 
     def on_message(self, event):
-        self.message = event.message.body;
+        self.message = event.message.body
 
     def on_link_opened(self, event):
         if event.receiver:
@@ -223,6 +228,6 @@
         self.rejected += 1
         event.connection.close()
 
+
 if __name__ == '__main__':
     unittest.main(main_module())
-
diff --git a/tests/system_tests_autolinks.py b/tests/system_tests_autolinks.py
index 4102c87..8329b28 100644
--- a/tests/system_tests_autolinks.py
+++ b/tests/system_tests_autolinks.py
@@ -93,6 +93,7 @@
     def run(self):
         Container(self).run()
 
+
 class NameCollisionTest(TestCase):
     @classmethod
     def setUpClass(cls):
@@ -109,7 +110,7 @@
                           'connection': 'brokerConnection',
                           'direction': 'in'}),
             ('linkRoute', {'name': 'linkRoute',
-                          'prefix': 'linkRoute',
+                           'prefix': 'linkRoute',
                            'connection': 'brokerConnection',
                            'direction': 'in'}),
             ('address',   {'name': 'address',
@@ -254,36 +255,36 @@
         cls.inter_router_port = cls.tester.get_port()
 
         cls.router('B',
-                    [
-                        ('router', {'mode': 'standalone', 'id': 'B'}),
-                        ('listener', {'role': 'normal',
-                                      'port': cls.tester.get_port()}),
-                        ('listener', {'host': '127.0.0.1',
-                                      'role': 'normal',
-                                      'port': cls.inter_router_port}),
-                        # Note here that the distribution of the address
-                        # 'examples' is set to 'unavailable'
-                        # This will ensure that any attach coming in for
-                        # this address will be rejected.
-                        ('address',
-                         {'prefix': 'examples',
-                          'name': 'unavailable-address',
-                          'distribution': 'unavailable'}),
-                    ])
+                   [
+                       ('router', {'mode': 'standalone', 'id': 'B'}),
+                       ('listener', {'role': 'normal',
+                                     'port': cls.tester.get_port()}),
+                       ('listener', {'host': '127.0.0.1',
+                                     'role': 'normal',
+                                     'port': cls.inter_router_port}),
+                       # Note here that the distribution of the address
+                       # 'examples' is set to 'unavailable'
+                       # This will ensure that any attach coming in for
+                       # this address will be rejected.
+                       ('address',
+                        {'prefix': 'examples',
+                         'name': 'unavailable-address',
+                         'distribution': 'unavailable'}),
+                   ])
 
         cls.router('A', [
-                        ('router', {'mode': 'standalone', 'id': 'A'}),
-                        ('listener', {'host': '127.0.0.1', 'role': 'normal',
-                                      'port': cls.tester.get_port()}),
+            ('router', {'mode': 'standalone', 'id': 'A'}),
+            ('listener', {'host': '127.0.0.1', 'role': 'normal',
+                          'port': cls.tester.get_port()}),
 
             ('connector', {'host': '127.0.0.1', 'name': 'connectorToB',
                            'role': 'route-container',
                            'port': cls.inter_router_port}),
 
-                        ('autoLink', {'connection': 'connectorToB',
-                                      'address': 'examples', 'direction': 'in'}),
-                        ('autoLink', {'connection': 'connectorToB',
-                                      'address': 'examples', 'direction': 'out'}),
+            ('autoLink', {'connection': 'connectorToB',
+                          'address': 'examples', 'direction': 'in'}),
+            ('autoLink', {'connection': 'connectorToB',
+                          'address': 'examples', 'direction': 'out'}),
         ])
 
     def __init__(self, test_method):
@@ -350,7 +351,7 @@
         # re-attempt to establish the autoLink and once the  autoLink
         # is up, it should return to the 'active' state.
         delete_command = 'DELETE --type=address --name=unavailable-address'
-        self.run_qdmanage(delete_command,  address=self.routers[0].addresses[0])
+        self.run_qdmanage(delete_command, address=self.routers[0].addresses[0])
 
         self.schedule_auto_link_reconnect_test()
 
@@ -381,23 +382,23 @@
         cls.backup_url = 'amqp://0.0.0.0:' + str(cls.backup_port)
 
         WaypointReceiverPhaseTest.router('A', [
-                        ('router', {'mode': 'interior', 'id': 'A'}),
-                        ('listener', {'host': '0.0.0.0', 'role': 'normal', 'port': cls.tester.get_port()}),
-                        ('listener', {'host': '0.0.0.0', 'role': 'inter-router', 'port': cls.inter_router_port}),
-                        ('autoLink', {'address': '0.0.0.0/queue.ext', 'direction': 'in', 'externalAddress': 'EXT'}),
-                        ('autoLink', {'address': '0.0.0.0/queue.ext', 'direction': 'out', 'externalAddress': 'EXT'}),
-                        ('address', {'prefix': '0.0.0.0/queue', 'waypoint': 'yes'}),
+            ('router', {'mode': 'interior', 'id': 'A'}),
+            ('listener', {'host': '0.0.0.0', 'role': 'normal', 'port': cls.tester.get_port()}),
+            ('listener', {'host': '0.0.0.0', 'role': 'inter-router', 'port': cls.inter_router_port}),
+            ('autoLink', {'address': '0.0.0.0/queue.ext', 'direction': 'in', 'externalAddress': 'EXT'}),
+            ('autoLink', {'address': '0.0.0.0/queue.ext', 'direction': 'out', 'externalAddress': 'EXT'}),
+            ('address', {'prefix': '0.0.0.0/queue', 'waypoint': 'yes'}),
 
-            ])
+        ])
 
         WaypointReceiverPhaseTest.router('B',
-                    [
-                        ('router', {'mode': 'interior', 'id': 'B'}),
-                        ('listener', {'host': '0.0.0.0', 'role': 'normal', 'port': cls.tester.get_port()}),
-                        ('connector', {'name': 'connectorToB', 'role': 'inter-router',
-                                       'port': cls.inter_router_port}),
-                        ('address', {'prefix': '0.0.0.0/queue', 'waypoint': 'yes'}),
-                    ])
+                                         [
+                                             ('router', {'mode': 'interior', 'id': 'B'}),
+                                             ('listener', {'host': '0.0.0.0', 'role': 'normal', 'port': cls.tester.get_port()}),
+                                             ('connector', {'name': 'connectorToB', 'role': 'inter-router',
+                                                            'port': cls.inter_router_port}),
+                                             ('address', {'prefix': '0.0.0.0/queue', 'waypoint': 'yes'}),
+                                         ])
 
         cls.routers[1].wait_router_connected('A')
 
@@ -501,7 +502,7 @@
             #
             # Set up the prefix 'node' as a prefix for waypoint addresses
             #
-            ('address',  {'prefix': 'node', 'waypoint': 'yes'}),
+            ('address', {'prefix': 'node', 'waypoint': 'yes'}),
 
             #
             # Create a pair of default auto-links for 'node.1'
@@ -540,7 +541,7 @@
         cmd = ['qdstat', '--bus', str(AutolinkTest.normal_address), '--timeout', str(TIMEOUT)] + ['-g']
         p = self.popen(
             cmd,
-            name='qdstat-'+self.id(), stdout=PIPE, expect=None,
+            name='qdstat-' + self.id(), stdout=PIPE, expect=None,
             universal_newlines=True)
 
         out = p.communicate()[0]
@@ -1147,7 +1148,7 @@
         self.route_conn  = event.container.connect(self.route_address)
         self.normal_conn = event.container.connect(self.normal_address)
         self.reply       = event.container.create_receiver(self.normal_conn, dynamic=True)
-        self.agent       = event.container.create_sender(self.normal_conn, "$management");
+        self.agent       = event.container.create_sender(self.normal_conn, "$management")
 
     def on_link_opening(self, event):
         if event.sender:
@@ -1164,7 +1165,7 @@
                 self.send_ops()
 
     def on_link_remote_close(self, event):
-        if event.link.remote_condition != None:
+        if event.link.remote_condition is not None:
             self.error = "Received unexpected error on link-close: %s" % event.link.remote_condition.name
             self.timer.cancel()
             self.normal_conn.close()
@@ -1181,10 +1182,10 @@
             while self.n_created < self.count and self.agent.credit > 0:
                 props = {'operation': 'CREATE',
                          'type': 'org.apache.qpid.dispatch.router.config.autoLink',
-                         'name': 'AL.%d' % self.n_created }
+                         'name': 'AL.%d' % self.n_created}
                 body  = {'direction': 'out',
                          'containerId': 'container.new',
-                         'address': 'node.%d' % self.n_created }
+                         'address': 'node.%d' % self.n_created}
                 msg = Message(properties=props, body=body, reply_to=self.reply_to)
                 self.agent.send(msg)
                 self.n_created += 1
@@ -1192,7 +1193,7 @@
             while self.n_deleted < self.count and self.agent.credit > 0:
                 props = {'operation': 'DELETE',
                          'type': 'org.apache.qpid.dispatch.router.config.autoLink',
-                         'name': 'AL.%d' % self.n_deleted }
+                         'name': 'AL.%d' % self.n_deleted}
                 body  = {}
                 msg = Message(properties=props, body=body, reply_to=self.reply_to)
                 self.agent.send(msg)
diff --git a/tests/system_tests_bad_configuration.py b/tests/system_tests_bad_configuration.py
index c679790..2c6eec7 100644
--- a/tests/system_tests_bad_configuration.py
+++ b/tests/system_tests_bad_configuration.py
@@ -200,6 +200,7 @@
             print("output: ", out)
             assert False, "AttributeError not in process output"
 
+
 class RouterTestIdFailWhiteSpace(TestCase):
     """
     This test case sets up a router using a configuration router id
diff --git a/tests/system_tests_broker.py b/tests/system_tests_broker.py
index 7fc7a78..ddc2ab1 100644
--- a/tests/system_tests_broker.py
+++ b/tests/system_tests_broker.py
@@ -34,7 +34,7 @@
 from itertools import cycle
 
 
-class DistributedQueueTest(system_test.TestCase): # pylint: disable=too-many-public-methods
+class DistributedQueueTest(system_test.TestCase):  # pylint: disable=too-many-public-methods
     """System tests involving routers and qpidd brokers"""
 
     if MISSING_REQUIREMENTS:
@@ -45,8 +45,8 @@
         def setUpClass(cls):
             """Start 3 qpidd brokers, wait for them to be ready."""
             super(DistributedQueueTest, cls).setUpClass()
-            cls.qpidds = [cls.tester.qpidd('qpidd%s'%i, port=cls.get_port(), wait=False)
-                        for i in range(3)]
+            cls.qpidds = [cls.tester.qpidd('qpidd%s' % i, port=cls.get_port(), wait=False)
+                          for i in range(3)]
             for q in cls.qpidds:
                 q.wait_ready()
 
@@ -56,7 +56,7 @@
 
         def setUp(self):
             super(DistributedQueueTest, self).setUp()
-            self.testq = 'testq.'+self.id().split('.')[-1] # The distributed queue name
+            self.testq = 'testq.' + self.id().split('.')[-1]  # The distributed queue name
 
         def common_router_conf(self, name, mode='standalone'):
             """Common router configuration for the tests"""
@@ -73,7 +73,7 @@
                 msgr.subscribe(a)
             msgr.flush()
             n = 20                  # Messages per broker
-            r = ["x-%02d"%i for i in range(n*len(self.qpidds))]
+            r = ["x-%02d" % i for i in range(n * len(self.qpidds))]
             for b, a in zip(r, cycle(send_addresses)):
                 msgr.put(message(address=a, body=b))
             msgr.flush()
@@ -96,18 +96,19 @@
 
             def router(i):
                 """Create router<i> with waypoints to each broker."""
-                name = "router%s"%i
+                name = "router%s" % i
                 rconf = self.common_router_conf(name, mode='interior')
                 rconf += [
-                    ('listener', {'port':self.get_port(), 'role':'normal'}),
+                    ('listener', {'port': self.get_port(), 'role': 'normal'}),
                 ]
                 for q in self.qpidds:
                     rconf += [
-                        ('connector', {'name':q.name, 'port':q.port})]
+                        ('connector', {'name': q.name, 'port': q.port})]
                 return self.qdrouterd(name, rconf, wait=False)
             routers = [router(i) for i in range(len(self.qpidds))]
-            for r in routers: r.wait_ready()
-            addrs = [r.addresses[0]+"/"+self.testq for r in routers]
+            for r in routers:
+                r.wait_ready()
+            addrs = [r.addresses[0] + "/" + self.testq for r in routers]
             self.verify_equal_spread(addrs, addrs)
 
 
diff --git a/tests/system_tests_cmdline_parsing.py b/tests/system_tests_cmdline_parsing.py
index efc0bae..a140109 100644
--- a/tests/system_tests_cmdline_parsing.py
+++ b/tests/system_tests_cmdline_parsing.py
@@ -35,6 +35,7 @@
 from system_test import TestCase, Qdrouterd, main_module, Process, wait_port
 from system_test import unittest
 
+
 class CommandLineTest(TestCase):
     """
     System tests for command line arguments parsing
@@ -53,7 +54,7 @@
         cls.config = Qdrouterd.Config([
             ('router', {'mode': 'standalone', 'id': CommandLineTest.name}),
             ('listener', {'port': CommandLineTest.testport}),
-            ('log',{'module':'DEFAULT', 'enable':'trace+', 'includeSource': 'true', 'outputFile': os.getcwd()+"/"+CommandLineTest.name+'.log'})
+            ('log', {'module': 'DEFAULT', 'enable': 'trace+', 'includeSource': 'true', 'outputFile': os.getcwd() + "/" + CommandLineTest.name + '.log'})
         ])
 
     def run_qdrouterd_as_daemon(self, config_file_name, pid_file_name):
@@ -85,7 +86,6 @@
         except OSError as ex:
             raise Exception("%s\n%s" % (ex, out))
 
-
     def test_01_config_relative_path(self):
         """
         Starts qdrouterd as daemon, enforcing a config file name with
@@ -93,10 +93,11 @@
         """
 
         try:
-            self.run_qdrouterd_as_daemon("test-router", os.getcwd()+'/test.pid')
+            self.run_qdrouterd_as_daemon("test-router", os.getcwd() + '/test.pid')
         except OSError as ex:
             self.fail(ex)
 
+
 class CommandLineTest2(TestCase):
     """
     System tests for command line arguments parsing
@@ -116,7 +117,7 @@
         cls.config = Qdrouterd.Config([
             ('router', {'mode': 'standalone', 'id': CommandLineTest2.testname}),
             ('listener', {'port': CommandLineTest2.testport}),
-            ('log',{'module':'DEFAULT', 'enable':'trace+', 'includeSource': 'true', 'output': os.getcwd()+"/"+CommandLineTest2.name+'.log'})
+            ('log', {'module': 'DEFAULT', 'enable': 'trace+', 'includeSource': 'true', 'output': os.getcwd() + "/" + CommandLineTest2.name + '.log'})
         ])
 
     def run_qdrouterd_as_daemon(self, config_file_name, pid_file_name):
@@ -148,7 +149,6 @@
         except OSError as ex:
             raise Exception("%s\n%s" % (ex, out))
 
-
     def test_02_config_full_path(self):
         """
         Starts qdrouterd as daemon, enforcing a config file name with
@@ -157,7 +157,7 @@
 
         try:
             self.run_qdrouterd_as_daemon(os.getcwd() + "/test-router-2.conf",
-                                pid_file_name=os.getcwd()+'/test.pid')
+                                         pid_file_name=os.getcwd() + '/test.pid')
         except OSError as ex:
             self.fail(ex)
 
diff --git a/tests/system_tests_connector_status.py b/tests/system_tests_connector_status.py
index 6f3b6c0..76b8f05 100644
--- a/tests/system_tests_connector_status.py
+++ b/tests/system_tests_connector_status.py
@@ -16,12 +16,14 @@
 # specific language governing permissions and limitations
 # under the License.
 #
-import json, re
+import json
+import re
 from threading import Timer
 
 from system_test import TestCase, Process, Qdrouterd, main_module, TIMEOUT, DIR
 from subprocess import PIPE, STDOUT
 
+
 class ConnectorStatusTest(TestCase):
 
     inter_router_port = None
@@ -56,7 +58,6 @@
                            'port': inter_router_port}),
         ]
 
-
         router('QDR.B', config_b)
 
         cls.routers[0].wait_ports()
@@ -113,7 +114,6 @@
         else:
             self.schedule_B_connector_test()
 
-
     def test_conn_status_before_connect(self):
         # The routers have connected and begun talking to each other
         # Verify that the connectionStatus field of the connector is set to SUCCESS.
@@ -146,5 +146,3 @@
         # SUCCESS. There is no good way to test if the connection status ever
         # reaches the FAILED state because the router immediately tries to
         # re-connect thus setting the status to CONNECTING in the process.
-
-
diff --git a/tests/system_tests_console.py b/tests/system_tests_console.py
index f72bffc..9e27724 100644
--- a/tests/system_tests_console.py
+++ b/tests/system_tests_console.py
@@ -44,6 +44,7 @@
 from proton.handlers import MessagingHandler
 from proton.reactor import Container
 
+
 class ConsolePreReq(object):
     @staticmethod
     def is_cmd(name):
@@ -65,6 +66,7 @@
         except OSError:
             return True
 
+
 class ConsoleTest(TestCase):
     """Run npm console tests"""
 
@@ -100,7 +102,7 @@
 
         router('B', 'interior',
                [('connector', {'name': 'connectorToA', 'role': 'inter-router',
-                    'port': interrouter_port}),
+                               'port': interrouter_port}),
                 ('listener', {'role': 'normal', 'port': cls.receiver_port})])
         cls.INT_B = cls.routers[1]
         cls.INT_B.listener = cls.INT_B.addresses[0]
@@ -117,13 +119,13 @@
         pret = 0
 
         out = ''
-        prg = ['npm',  'test', '--', '--watchAll=false']
+        prg = ['npm', 'test', '--', '--watchAll=false']
 
-        p = self.popen(prg, 
-            cwd=os.path.join(os.environ.get('BUILD_DIR'), 'console'),
-            env=dict(os.environ, TEST_PORT="%d" % self.http_port),
-            stdout=PIPE, 
-            expect=None)
+        p = self.popen(prg,
+                       cwd=os.path.join(os.environ.get('BUILD_DIR'), 'console'),
+                       env=dict(os.environ, TEST_PORT="%d" % self.http_port),
+                       stdout=PIPE,
+                       expect=None)
         out = p.communicate()[0]
         pret = p.returncode
 
@@ -146,6 +148,7 @@
     def test_console(self):
         self.run_console_test()
 
+
 class AsyncStopableSender(AsyncTestSender):
     def __init__(self, hostport, address):
         super(AsyncStopableSender, self).__init__(hostport, address, 999999999)
@@ -172,6 +175,8 @@
             raise Exception("AsyncStopableSender did not exit")
 
 # Based on gsim's slow_recv.py
+
+
 class TimedFlow(MessagingHandler):
     def __init__(self, receiver, credit):
         super(TimedFlow, self).__init__()
@@ -181,6 +186,7 @@
     def on_timer_task(self, event):
         self.receiver.flow(self.credit)
 
+
 class AsyncSlowReceiver(AsyncTestReceiver):
     def __init__(self, hostport, target):
         super(AsyncSlowReceiver, self).__init__(hostport, target, msg_args={"prefetch": 0})
@@ -200,9 +206,10 @@
             self.request_batch(event)
 
     def on_message(self, event):
-        print (event.message.body)
+        print(event.message.body)
         if self.check_empty(event.receiver):
             self.request_batch(event)
 
+
 if __name__ == '__main__':
     unittest.main(main_module())
diff --git a/tests/system_tests_core_client.py b/tests/system_tests_core_client.py
index b9829fe..d4cd0b8 100644
--- a/tests/system_tests_core_client.py
+++ b/tests/system_tests_core_client.py
@@ -37,6 +37,7 @@
 CONTAINER_ID = "org.apache.qpid.dispatch.test_core_client"
 TARGET_ADDR = "test_core_client_address"
 
+
 class CoreClientAPITest(TestCase):
     @classmethod
     def setUpClass(cls):
@@ -164,7 +165,7 @@
         self._container.start()
         while self._container.process():
             if self._conn is None and self._container.quiesced:
-                break;
+                break
         self._container.stop()
         self._container.process()
 
diff --git a/tests/system_tests_core_endpoint.py b/tests/system_tests_core_endpoint.py
index f651e46..70eceab 100644
--- a/tests/system_tests_core_endpoint.py
+++ b/tests/system_tests_core_endpoint.py
@@ -62,7 +62,6 @@
 
         router('A', ('listener', {'role': 'inter-router', 'port': inter_router_port}), ["-T"])
 
-
     def test_01_denied_link(self):
         test = DenyLinkTest(self.routers[0].addresses[0], "org.apache.qpid.dispatch.router/test/deny")
         test.run()
@@ -91,7 +90,7 @@
 
 class DenyLinkTest(MessagingHandler):
     def __init__(self, host, address):
-        super(DenyLinkTest, self).__init__(prefetch = 0)
+        super(DenyLinkTest, self).__init__(prefetch=0)
         self.host      = host
         self.address   = address
 
@@ -130,7 +129,7 @@
 
 class DiscardTest(MessagingHandler):
     def __init__(self, host, address):
-        super(DiscardTest, self).__init__(prefetch = 0)
+        super(DiscardTest, self).__init__(prefetch=0)
         self.host      = host
         self.address   = address
 
@@ -178,7 +177,7 @@
 
 class SourceTest(MessagingHandler):
     def __init__(self, host, address, count, expected_ps):
-        super(SourceTest, self).__init__(prefetch = 0)
+        super(SourceTest, self).__init__(prefetch=0)
         self.host        = host
         self.address     = address
         self.expected_ps = expected_ps
@@ -225,7 +224,7 @@
 
 class EchoTest(MessagingHandler):
     def __init__(self, host, address):
-        super(EchoTest, self).__init__(prefetch = 0)
+        super(EchoTest, self).__init__(prefetch=0)
         self.host      = host
         self.address   = address
 
diff --git a/tests/system_tests_default_distribution.py b/tests/system_tests_default_distribution.py
index 79fd90e..782ea16 100644
--- a/tests/system_tests_default_distribution.py
+++ b/tests/system_tests_default_distribution.py
@@ -51,14 +51,15 @@
 
     def run_qdstat(self, args, regexp=None, address=None):
         p = self.popen(
-            ['qdstat', '--bus', str(address or self.address), '--timeout', str(TIMEOUT) ] + args,
-            name='qdstat-'+self.id(), stdout=PIPE, expect=None,
+            ['qdstat', '--bus', str(address or self.address), '--timeout', str(TIMEOUT)] + args,
+            name='qdstat-' + self.id(), stdout=PIPE, expect=None,
             universal_newlines=True)
 
         out = p.communicate()[0]
         assert p.returncode == 0, \
             "qdstat exit status %s, output:\n%s" % (p.returncode, out)
-        if regexp: assert re.search(regexp, out, re.I), "Can't find '%s' in '%s'" % (regexp, out)
+        if regexp:
+            assert re.search(regexp, out, re.I), "Can't find '%s' in '%s'" % (regexp, out)
         return out
 
     def test_create_unavailable_sender(self):
@@ -121,6 +122,7 @@
     def run(self):
         Container(self).run()
 
+
 class UnavailableSender(UnavailableBase):
     def __init__(self, address):
         super(UnavailableSender, self).__init__(address)
@@ -137,6 +139,7 @@
         # "Node not found"
         self.sender = event.container.create_sender(self.conn, self.dest, name=self.link_name)
 
+
 class UnavailableReceiver(UnavailableBase):
     def __init__(self, address):
         super(UnavailableReceiver, self).__init__(address)
@@ -153,6 +156,7 @@
         # "Node not found"
         self.receiver = event.container.create_receiver(self.conn, self.dest, name=self.link_name)
 
+
 class UnavailableAnonymousSender(MessagingHandler):
     def __init__(self, address):
         super(UnavailableAnonymousSender, self).__init__()
diff --git a/tests/system_tests_delivery_abort.py b/tests/system_tests_delivery_abort.py
index 0a5e600..4a05b5b 100644
--- a/tests/system_tests_delivery_abort.py
+++ b/tests/system_tests_delivery_abort.py
@@ -66,7 +66,6 @@
         cls.routers[0].wait_router_connected('B')
         cls.routers[1].wait_router_connected('A')
 
-
     def test_01_message_route_truncated_one_router(self):
         test = MessageRouteTruncateTest(self.routers[0].addresses[0],
                                         self.routers[0].addresses[0],
@@ -74,7 +73,6 @@
         test.run()
         self.assertEqual(None, test.error)
 
-
     def test_02_message_route_truncated_two_routers(self):
         test = MessageRouteTruncateTest(self.routers[0].addresses[0],
                                         self.routers[1].addresses[0],
@@ -82,7 +80,6 @@
         test.run()
         self.assertEqual(None, test.error)
 
-
     def test_03_link_route_truncated_one_router(self):
         test = LinkRouteTruncateTest(self.routers[0].addresses[0],
                                      self.routers[0].addresses[1],
@@ -91,7 +88,6 @@
         test.run()
         self.assertEqual(None, test.error)
 
-
     def test_04_link_route_truncated_two_routers(self):
         test = LinkRouteTruncateTest(self.routers[1].addresses[0],
                                      self.routers[0].addresses[1],
@@ -100,7 +96,6 @@
         test.run()
         self.assertEqual(None, test.error)
 
-
     def test_05_message_route_abort_one_router(self):
         test = MessageRouteAbortTest(self.routers[0].addresses[0],
                                      self.routers[0].addresses[0],
@@ -110,7 +105,6 @@
             test.logger.dump()
         self.assertEqual(None, test.error)
 
-
     def test_06_message_route_abort_two_routers(self):
         test = MessageRouteAbortTest(self.routers[0].addresses[0],
                                      self.routers[1].addresses[0],
@@ -120,7 +114,6 @@
             test.logger.dump()
         self.assertEqual(None, test.error)
 
-
     def test_07_multicast_truncate_one_router(self):
         test = MulticastTruncateTest(self.routers[0].addresses[0],
                                      self.routers[0].addresses[0],
@@ -373,7 +366,7 @@
 
     def run(self):
         container = Container(self)
-        container.container_id="LRC"
+        container.container_id = "LRC"
         container.run()
 
 
@@ -422,7 +415,7 @@
         op, size = self.program.pop(0) if len(self.program) > 0 else (None, None)
         self.logger.log("send - op=%s, size=%s" % (str(op), str(size)))
 
-        if op == None:
+        if op is None:
             return
 
         body = ""
@@ -434,7 +427,7 @@
             bod3 = "." + bod2[-9:]
             body = bod3 * (size // 10)
         msg = Message(body=body)
-        
+
         if op in 'DF':
             self.logger.log("send(): Send message size: %d" % (size))
             delivery = self.sender1.send(msg)
@@ -452,7 +445,7 @@
         self.sender_conn.close()
         self.receiver_conn.close()
         self.timer.cancel()
-        
+
     def on_sendable(self, event):
         self.logger.log("on_sendable")
         if event.sender == self.sender1:
@@ -468,7 +461,7 @@
         if m.body == "FINISH":
             self.finish()
         else:
-            self.logger.log("on_message receives len: %d" %(len(m.body)))
+            self.logger.log("on_message receives len: %d" % (len(m.body)))
             self.result.append(len(m.body))
             self.send()
 
@@ -582,6 +575,7 @@
             self.sender3 = event.container.create_sender(self.sender_conn,
                                                          self.address,
                                                          name="S3")
+
     def on_message(self, event):
         m = event.message
         if event.receiver == self.receiver1:
diff --git a/tests/system_tests_delivery_counts.py b/tests/system_tests_delivery_counts.py
index 6986308..92b109f 100644
--- a/tests/system_tests_delivery_counts.py
+++ b/tests/system_tests_delivery_counts.py
@@ -39,12 +39,14 @@
                             'deliveryCount',
                             'modifiedCount'])
 
+
 def get_body(n_sent, large_message=False):
     if large_message:
         body = {'number': n_sent, 'msg': LARGE_PAYLOAD}
     else:
         body = {'number': n_sent}
 
+
 def _link_stats_are_zero(statistics, keys):
     """
     Verify that all statistics whose keys are present are zero
@@ -52,7 +54,7 @@
     for key in keys:
         if statistics.get(key) != 0:
             return False
-    return True;
+    return True
 
 
 class OneRouterModifiedTest(TestCase):
@@ -107,6 +109,7 @@
     def test_one_router_large_message_modified_counts(self):
         self.router_modified_counts(True)
 
+
 class OneRouterRejectedTest(TestCase):
     @classmethod
     def setUpClass(cls):
@@ -208,12 +211,14 @@
                                                                          'releasedCount',
                                                                          'presettledCount',
                                                                          'droppedPresettledCount'])))
+
     def test_one_router_released_dropped_counts(self):
         self.one_router_released_dropped_count()
 
     def test_one_router_large_message_released_dropped_counts(self):
         self.one_router_released_dropped_count(True)
 
+
 class TwoRouterReleasedDroppedPresettledTest(TestCase):
     @classmethod
     def setUpClass(cls):
@@ -228,13 +233,13 @@
             ('address', {'prefix': 'multicast', 'distribution': 'multicast'}),
             ('listener', {'port': listen_port_1, 'authenticatePeer': False, 'saslMechanisms': 'ANONYMOUS'}),
             ('listener', {'role': 'inter-router', 'port': listen_port_inter_router, 'authenticatePeer': False, 'saslMechanisms': 'ANONYMOUS'}),
-           ])
+        ])
 
         config_2 = Qdrouterd.Config([
             ('router', {'mode': 'interior', 'id': 'B'}),
             ('listener', {'port': listen_port_2, 'authenticatePeer': False, 'saslMechanisms': 'ANONYMOUS'}),
             ('connector', {'name': 'connectorToA', 'role': 'inter-router', 'port': listen_port_inter_router}),
-            ])
+        ])
 
         cls.routers = []
         cls.routers.append(cls.tester.qdrouterd("A", config_1, wait=True))
@@ -285,7 +290,7 @@
         self.two_router_released_dropped_counts(True)
 
 
-class AddressCheckerTimeout ( object ):
+class AddressCheckerTimeout (object):
     def __init__(self, parent):
         self.parent = parent
 
@@ -293,13 +298,14 @@
         self.parent.address_check_timeout()
 
 
-class CounterCheckerTimeout ( object ):
+class CounterCheckerTimeout (object):
     def __init__(self, parent):
         self.parent = parent
 
     def on_timer_task(self, event):
         self.parent.count_check_timeout()
 
+
 class LargePresettledLinkCounterTest(MessagingHandler):
     def __init__(self, sender_addr, receiver_addr):
         super(LargePresettledLinkCounterTest, self).__init__()
@@ -343,8 +349,8 @@
             # to router A.
             self.sender_conn = self.container.connect(self.sender_addr)
             self.sender = self.container.create_sender(self.sender_conn,
-                                                        self.dest,
-                                                        name='SenderA')
+                                                       self.dest,
+                                                       name='SenderA')
         else:
             if self.num_attempts < 2:
                 self.address_check_timer = self.reactor.schedule(2,
@@ -406,7 +412,7 @@
         self.receiver_dropoff_count = 50
         self.num_messages = 200
         self.num_attempts = 0
-        self.n_sent= 0
+        self.n_sent = 0
         self.done = False
         self.n_received = 0
         self.count_check_timer = None
@@ -516,13 +522,13 @@
             ('address', {'prefix': 'multicast', 'distribution': 'multicast'}),
             ('listener', {'port': listen_port_1, 'authenticatePeer': False, 'saslMechanisms': 'ANONYMOUS'}),
             ('listener', {'role': 'inter-router', 'port': listen_port_inter_router, 'authenticatePeer': False, 'saslMechanisms': 'ANONYMOUS'}),
-           ])
+        ])
 
         config_2 = Qdrouterd.Config([
             ('router', {'mode': 'interior', 'id': 'B'}),
             ('listener', {'port': listen_port_2, 'authenticatePeer': False, 'saslMechanisms': 'ANONYMOUS'}),
             ('connector', {'name': 'connectorToA', 'role': 'inter-router', 'port': listen_port_inter_router}),
-            ])
+        ])
 
         cls.routers = []
         cls.routers.append(cls.tester.qdrouterd("A", config_1, wait=True))
@@ -556,13 +562,13 @@
             ('address', {'prefix': 'multicast', 'distribution': 'multicast'}),
             ('listener', {'port': listen_port_1, 'authenticatePeer': False, 'saslMechanisms': 'ANONYMOUS'}),
             ('listener', {'role': 'inter-router', 'port': listen_port_inter_router, 'authenticatePeer': False, 'saslMechanisms': 'ANONYMOUS'}),
-           ])
+        ])
 
         config_2 = Qdrouterd.Config([
             ('router', {'mode': 'interior', 'id': 'B'}),
             ('listener', {'port': listen_port_2, 'authenticatePeer': False, 'saslMechanisms': 'ANONYMOUS'}),
             ('connector', {'name': 'connectorToA', 'role': 'inter-router', 'port': listen_port_inter_router}),
-            ])
+        ])
 
         cls.routers = []
         cls.routers.append(cls.tester.qdrouterd("A", config_1, wait=True))
@@ -582,7 +588,6 @@
         self.assertTrue(test.success)
 
 
-
 class LinkRouteIngressEgressTransitTest(TestCase):
     @classmethod
     def setUpClass(cls):
@@ -592,7 +597,7 @@
         def router(name, connection):
 
             config = [
-                ('router', {'mode': 'interior', 'id': 'QDR.%s'%name}),
+                ('router', {'mode': 'interior', 'id': 'QDR.%s' % name}),
             ] + connection
 
             config = Qdrouterd.Config(config)
@@ -629,7 +634,7 @@
 
                    ('linkRoute', {'prefix': 'pulp.task', 'direction': 'in'}),
                    ('linkRoute', {'prefix': 'pulp.task', 'direction': 'out'}),
-                ]
+               ]
                )
 
         # Wait for the routers to locate each other, and for route propagation
@@ -700,6 +705,7 @@
     def test_link_route_large_message_ingress_egress_transit_counts(self):
         self.link_route_ingress_egress_transit_counts(True)
 
+
 class TwoRouterIngressEgressTest(TestCase):
     @classmethod
     def setUpClass(cls):
@@ -713,13 +719,13 @@
             ('router', {'mode': 'interior', 'id': 'A'}),
             ('listener', {'port': listen_port_1, 'authenticatePeer': False, 'saslMechanisms': 'ANONYMOUS'}),
             ('listener', {'role': 'inter-router', 'port': listen_port_inter_router, 'authenticatePeer': False, 'saslMechanisms': 'ANONYMOUS'}),
-           ])
+        ])
 
         config_2 = Qdrouterd.Config([
             ('router', {'mode': 'interior', 'id': 'B'}),
             ('listener', {'port': listen_port_2, 'authenticatePeer': False, 'saslMechanisms': 'ANONYMOUS'}),
             ('connector', {'name': 'connectorToA', 'role': 'inter-router', 'port': listen_port_inter_router}),
-            ])
+        ])
 
         cls.routers = []
         cls.routers.append(cls.tester.qdrouterd("A", config_1, wait=True))
@@ -781,7 +787,6 @@
                                              _LINK_STATISTIC_KEYS - set(['deliveryCount',
                                                                          'acceptedCount'])))
 
-
         self.assertEqual(test.receiver_stats['deliveryCount'], num_messages)
         self.assertEqual(test.receiver_stats['acceptedCount'], num_messages)
         self.assertTrue(_link_stats_are_zero(test.receiver_stats,
@@ -800,6 +805,7 @@
     def test_two_router_large_message_ingress_egress_counts(self):
         self.two_router_ingress_egress_counts(True)
 
+
 class OneRouterIngressEgressTest(TestCase):
     @classmethod
     def setUpClass(cls):
@@ -947,7 +953,6 @@
 
         cls.router = cls.tester.qdrouterd(name="LinkCounters", config=config, wait=True)
 
-
     class LinkCountersTest(MessagingHandler):
         """
         Create 1 sender and 1 receiver to router_addr.  Send count messages.
@@ -955,6 +960,7 @@
         Explicitly set the receiver credit and whether to sender sends
         presettled or unsettled messages.
         """
+
         def __init__(self, router_addr, count=None, rx_limit=None,
                      credit=None, presettled=False, outcome=None,
                      large_message=False):
@@ -1020,6 +1026,7 @@
             self.sender = event.container.create_sender(self.conn,
                                                         target="Test01",
                                                         name="Tx_Test01")
+
         def on_sendable(self, event):
             if self.sent < self.count:
                 if self.large_message:
@@ -1090,13 +1097,12 @@
                                              - set(['deliveryCount',
                                                     'unsettledCount'])))
 
-
     def verify_presettled_count(self, large_message=False):
         """
         Verify the presettled dropped count link counter by exhausting credit
         before sending is complete
         """
-        limit = self.CREDIT//2  # 1/2 the capacity given the sender
+        limit = self.CREDIT // 2  # 1/2 the capacity given the sender
         test = self.LinkCountersTest(self.router.addresses[0],
                                      presettled=True,
                                      count=self.COUNT,
@@ -1197,7 +1203,6 @@
         self.verify_one_credit_accepted(True)
 
 
-
 class RouteContainerIngressCount(TestCase):
     @classmethod
     def setUpClass(cls):
@@ -1286,9 +1291,9 @@
         if not self.done and self.num_messages == self.n_received and self.n_accept == self.num_messages:
             self.done = True
             self.sender_stats = get_link_info('Tx_IngressEgressTwoRouterTest',
-                                               self.sender_address)
+                                              self.sender_address)
             self.receiver_stats = get_link_info('Rx_IngressEgressTwoRouterTest',
-                                                 self.receiver_address)
+                                                self.receiver_address)
             self.conn_sender.close()
             self.conn_recv.close()
             self.timer.cancel()
@@ -1570,9 +1575,9 @@
                               and self.n_sent == self.n_accepted):
             self.done = True
             self.sender_stats = get_link_info('Tx_IngressEgressTransitLinkRouteTest',
-                                               self.sender_addr)
+                                              self.sender_addr)
             self.receiver_stats = get_link_info('Rx_IngressEgressTransitLinkRouteTest',
-                                                 self.receiver_addr)
+                                                self.receiver_addr)
             self.receiver_conn.close()
             self.sender_conn.close()
             self.timer.cancel()
@@ -1636,7 +1641,7 @@
         if not self.done and self.expect_released == self.n_released:
             self.done = True
             self.sender_stats = get_link_info('ReleasedDroppedPresettledCountTest',
-                                               self.sender_addr)
+                                              self.sender_addr)
             self.sender_conn.close()
             self.timer.cancel()
 
@@ -1653,6 +1658,7 @@
         # will be dropped
         self.sender = event.container.create_sender(self.sender_conn,
                                                     name='ReleasedDroppedPresettledCountTest')
+
     def on_sendable(self, event):
         # We are sending a total of 20 deliveries. 10 unsettled and 10 pre-settled to a multicast address
         if self.n_sent < self.num_messages:
diff --git a/tests/system_tests_deprecated.py b/tests/system_tests_deprecated.py
index b973566..b9142d6 100644
--- a/tests/system_tests_deprecated.py
+++ b/tests/system_tests_deprecated.py
@@ -69,7 +69,6 @@
 
         name = "test-autolink"
 
-
         config = Qdrouterd.Config([
             ('router', {'mode': 'standalone', 'id': 'QDR.B'}),
             # We are trying to declare a link route with both 'dir' and 'direction' attributes.
@@ -77,7 +76,7 @@
             ('autoLink', {'externalAddr': 'node.100', 'addr': 'node.10',
                           'containerId': 'container.1',
                           'direction': 'out'}),
-            ('autoLink', {'addr': 'node.1', 'containerId': 'container.1', 'dir': 'in',  'direction': 'in'}),
+            ('autoLink', {'addr': 'node.1', 'containerId': 'container.1', 'dir': 'in', 'direction': 'in'}),
             ('autoLink', {'addr': 'node.1', 'containerId': 'container.1', 'direction': 'out'}),
 
             ('listener', {'port': cls.tester.get_port()}),
@@ -98,12 +97,5 @@
             self.assertTrue(len(search_lines) > 0)
 
             external_addr_search_lines = [s for s in log_lines if
-                            "Attribute 'externalAddr' of entity 'autoLink' has been deprecated. Use 'externalAddress' instead" in s]
+                                          "Attribute 'externalAddr' of entity 'autoLink' has been deprecated. Use 'externalAddress' instead" in s]
             self.assertTrue(len(external_addr_search_lines) > 0)
-
-
-
-
-
-
-
diff --git a/tests/system_tests_disallow_link_resumable_link_route.py b/tests/system_tests_disallow_link_resumable_link_route.py
index ae12f8c..f532954 100644
--- a/tests/system_tests_disallow_link_resumable_link_route.py
+++ b/tests/system_tests_disallow_link_resumable_link_route.py
@@ -34,6 +34,7 @@
 
 from qpid_dispatch.management.client import Node
 
+
 class SenderExpiry(SenderOption):
     def __init__(self, expiry):
         self.expiry = expiry
@@ -41,6 +42,7 @@
     def apply(self, sender):
         sender.target.expiry_policy = self.expiry
 
+
 class SenderTimeout(SenderOption):
     def __init__(self, timeout):
         self.timeout = timeout
@@ -48,6 +50,7 @@
     def apply(self, sender):
         sender.target.timeout = self.timeout
 
+
 class LinkRouteTest(TestCase):
     @classmethod
     def get_router(cls, index):
@@ -73,10 +76,10 @@
                ])
         router('B',
                [
-                   #disallow resumable links
-                   ('router', {'mode': 'interior', 'id': 'QDR.B', 'allowResumableLinkRoute':False}),
+                   # disallow resumable links
+                   ('router', {'mode': 'interior', 'id': 'QDR.B', 'allowResumableLinkRoute': False}),
                    ('listener', {'role': 'normal', 'host': '0.0.0.0', 'port': b_listener_port, 'saslMechanisms': 'ANONYMOUS'}),
-                   #define link routes
+                   # define link routes
                    ('connector', {'name': 'broker', 'role': 'route-container', 'host': '0.0.0.0', 'port': a_listener_port, 'saslMechanisms': 'ANONYMOUS'}),
                    ('linkRoute', {'prefix': 'org.apache', 'containerId': 'QDR.A', 'dir': 'in'}),
                    ('linkRoute', {'prefix': 'org.apache', 'containerId': 'QDR.A', 'dir': 'out'}),
@@ -111,7 +114,6 @@
         if not counted:
             self.fail("Interrouter link route failed to connect after %f seconds" % waitTimeS)
 
-
     def test_normal_receiver_allowed(self):
         addr = self.routers[1].addresses[0]
 
diff --git a/tests/system_tests_distribution.py b/tests/system_tests_distribution.py
index d8c6807..fbe406c 100644
--- a/tests/system_tests_distribution.py
+++ b/tests/system_tests_distribution.py
@@ -23,22 +23,23 @@
 from __future__ import print_function
 
 import sys
-from proton          import Message
-from system_test     import TestCase, Qdrouterd, main_module, TIMEOUT, SkipIfNeeded, TestTimeout
-from system_test     import unittest
+from proton import Message
+from system_test import TestCase, Qdrouterd, main_module, TIMEOUT, SkipIfNeeded, TestTimeout
+from system_test import unittest
 from proton.handlers import MessagingHandler
-from proton.reactor  import Container, LinkOption, ApplicationEvent, EventInjector
+from proton.reactor import Container, LinkOption, ApplicationEvent, EventInjector
 
 
-#------------------------------------------------
+# ------------------------------------------------
 # Helper classes for all tests.
-#------------------------------------------------
+# ------------------------------------------------
 
 
 class AddressCheckResponse(object):
     """
     Convenience class for the responses returned by an AddressChecker.
     """
+
     def __init__(self, status_code, status_description, attrs):
         self.status_code        = status_code
         self.status_description = status_description
@@ -48,29 +49,28 @@
         return self.attrs[key]
 
 
-
-class AddressChecker ( object ):
+class AddressChecker (object):
     """
     Format address-query messages and parse the responses.
     """
-    def __init__ ( self, reply_addr ):
+
+    def __init__(self, reply_addr):
         self.reply_addr = reply_addr
 
-    def parse_address_query_response ( self, msg ):
+    def parse_address_query_response(self, msg):
         ap = msg.properties
-        return AddressCheckResponse ( ap['statusCode'], ap['statusDescription'], msg.body )
+        return AddressCheckResponse(ap['statusCode'], ap['statusDescription'], msg.body)
 
-    def make_address_query ( self, name ):
+    def make_address_query(self, name):
         ap = {'operation': 'READ', 'type': 'org.apache.qpid.dispatch.router.address', 'name': name}
-        return Message ( properties=ap, reply_to=self.reply_addr )
+        return Message(properties=ap, reply_to=self.reply_addr)
 
-    def make_addresses_query ( self ):
+    def make_addresses_query(self):
         ap = {'operation': 'QUERY', 'type': 'org.apache.qpid.dispatch.router.address'}
-        return Message ( properties=ap, reply_to=self.reply_addr )
+        return Message(properties=ap, reply_to=self.reply_addr)
 
 
-
-class AddressCheckerTimeout ( object ):
+class AddressCheckerTimeout (object):
     def __init__(self, parent):
         self.parent = parent
 
@@ -108,18 +108,16 @@
             }
 
 
-#------------------------------------------------
+# ------------------------------------------------
 # END Helper classes for all tests.
-#------------------------------------------------
+# ------------------------------------------------
 
 
-
-
-#================================================================
+# ================================================================
 #     Setup
-#================================================================
+# ================================================================
 
-class DistributionTests ( TestCase ):
+class DistributionTests (TestCase):
 
     @classmethod
     def setUpClass(cls):
@@ -132,68 +130,66 @@
         """
         super(DistributionTests, cls).setUpClass()
 
-
         cls.linkroute_prefix   = "0.0.0.0/linkroute"
         cls.waypoint_prefix_1  = "0.0.0.0/process_1"
         cls.waypoint_prefix_2  = "0.0.0.0/process_2"
         cls.waypoint_prefix_3  = "0.0.0.0/process_3"
 
-        #-----------------------------------------------------
+        # -----------------------------------------------------
         # Container IDs are what associate route containers
         # with links -- for the linkroute tests and the
         # waypoint tests.
-        #-----------------------------------------------------
-        cls.container_ids = [ 'ethics_gradient',
-                              'honest_mistake',
-                              'frank_exchange_of_views',
-                              'zero_gravitas',
-                              'yawning_angel'
-                            ]
+        # -----------------------------------------------------
+        cls.container_ids = ['ethics_gradient',
+                             'honest_mistake',
+                             'frank_exchange_of_views',
+                             'zero_gravitas',
+                             'yawning_angel'
+                             ]
 
-        #-----------------------------------------------------
+        # -----------------------------------------------------
         # Here are some chunks of configuration that will be
         # the same on all routers.
-        #-----------------------------------------------------
+        # -----------------------------------------------------
 
         linkroute_configuration =             \
-        [
-            ( 'linkRoute',
-              { 'prefix': cls.linkroute_prefix,
-                'direction': 'in',
-                'containerId': cls.container_ids[0]
-              }
-            ),
-            ( 'linkRoute',
-              { 'prefix': cls.linkroute_prefix,
-                'direction': 'out',
-                'containerId': cls.container_ids[0]
-              }
-            )
-        ]
-
+            [
+                ('linkRoute',
+                 {'prefix': cls.linkroute_prefix,
+                  'direction': 'in',
+                  'containerId': cls.container_ids[0]
+                  }
+                 ),
+                ('linkRoute',
+                 {'prefix': cls.linkroute_prefix,
+                  'direction': 'out',
+                  'containerId': cls.container_ids[0]
+                  }
+                 )
+            ]
 
         single_waypoint_configuration =        \
-        [
-            ( 'address',
-              { 'prefix': cls.waypoint_prefix_1,
-                'waypoint': 'yes'
-              }
-            ),
-            ( 'autoLink',
-              { 'address': cls.waypoint_prefix_1 + '.waypoint',
-                'containerId': cls.container_ids[1],
-                'direction': 'in'
-              }
-            ),
-            ( 'autoLink',
-              { 'address': cls.waypoint_prefix_1 + '.waypoint',
-                'containerId': cls.container_ids[1],
-                'direction': 'out'
-              }
-            )
-        ]
+            [
+                ('address',
+                 {'prefix': cls.waypoint_prefix_1,
+                  'waypoint': 'yes'
+                  }
+                 ),
+                ('autoLink',
+                 {'address': cls.waypoint_prefix_1 + '.waypoint',
+                  'containerId': cls.container_ids[1],
+                  'direction': 'in'
+                  }
+                 ),
+                ('autoLink',
+                 {'address': cls.waypoint_prefix_1 + '.waypoint',
+                  'containerId': cls.container_ids[1],
+                  'direction': 'out'
+                  }
+                 )
+            ]
 
-        #-------------------------------------------------------------------
+        # -------------------------------------------------------------------
         # The phase-number is used by the router as an addition
         # to the address for the link. To chain these two waypoints
         # together in a serial fashion, we explicitly declare their
@@ -206,57 +202,56 @@
         #        back from process to router: phase 2
         #
         # Because of those two "phase 1" markings, messages coming back
-        # into the router from Waypoint 1 get routed back outbound to 
+        # into the router from Waypoint 1 get routed back outbound to
         # Waypoint 2.
         #
         # Because the address configuration specifies that phase 2 is
-        # the egress phase, messages coming into the router from that 
+        # the egress phase, messages coming into the router from that
         # autolink are finally routed to the client receiver.
-        #-------------------------------------------------------------------
+        # -------------------------------------------------------------------
         serial_waypoint_configuration =  \
-        [
-            ( 'address',
-              { 'prefix': cls.waypoint_prefix_2,
-                'ingressPhase' : 0,    # into the waypoint-process
-                'egressPhase'  : 2,    # out of the waypoint process
-              }
-            ),
+            [
+                ('address',
+                 {'prefix': cls.waypoint_prefix_2,
+                  'ingressPhase': 0,    # into the waypoint-process
+                  'egressPhase': 2,    # out of the waypoint process
+                  }
+                 ),
 
-            # Waypoint 1 configuration --------------------------
-            ( 'autoLink',
-              { 'address': cls.waypoint_prefix_2 + '.waypoint',
-                'phase' : 0,
-                'containerId': cls.container_ids[2],
-                'direction': 'out'    # out-of-router
-              }
-            ),
-            ( 'autoLink',
-              { 'address': cls.waypoint_prefix_2 + '.waypoint',
-                'phase' : 1,
-                'containerId': cls.container_ids[2],
-                'direction': 'in'    # into-router
-              }
-            ),
+                # Waypoint 1 configuration --------------------------
+                ('autoLink',
+                 {'address': cls.waypoint_prefix_2 + '.waypoint',
+                  'phase' : 0,
+                  'containerId': cls.container_ids[2],
+                  'direction': 'out'    # out-of-router
+                  }
+                 ),
+                ('autoLink',
+                 {'address': cls.waypoint_prefix_2 + '.waypoint',
+                  'phase' : 1,
+                  'containerId': cls.container_ids[2],
+                  'direction': 'in'    # into-router
+                  }
+                 ),
 
-            # Waypoint 2 configuration --------------------------
-            ( 'autoLink',
-              { 'address': cls.waypoint_prefix_2 + '.waypoint',
-                'phase' : 1,   # out-of-router
-                'containerId': cls.container_ids[2],
-                'direction': 'out'
-              }
-            ),
-            ( 'autoLink',
-              { 'address': cls.waypoint_prefix_2 + '.waypoint',
-                'phase' : 2,   # into-router
-                'containerId': cls.container_ids[2],
-                'direction': 'in'
-              }
-            )
-        ]
+                # Waypoint 2 configuration --------------------------
+                ('autoLink',
+                 {'address': cls.waypoint_prefix_2 + '.waypoint',
+                  'phase' : 1,   # out-of-router
+                  'containerId': cls.container_ids[2],
+                  'direction': 'out'
+                  }
+                 ),
+                ('autoLink',
+                 {'address': cls.waypoint_prefix_2 + '.waypoint',
+                  'phase' : 2,   # into-router
+                  'containerId': cls.container_ids[2],
+                  'direction': 'in'
+                  }
+                 )
+            ]
 
-
-        #-------------------------------------------------------------
+        # -------------------------------------------------------------
         # In a parallel waypoint configuration, we use the default
         # phase numbers: toward the waypoint is phase 0, back from
         # the waypoint into the router is phase 1.
@@ -264,57 +259,56 @@
         # shorthand for "ingress is phase 0, egress is phase 1"
         # By making two identical waypoints, they will be used in
         # parallel rather than serial.
-        #-------------------------------------------------------------
+        # -------------------------------------------------------------
         parallel_waypoint_configuration =  \
-        [
-            ( 'address',
-              { 'prefix': cls.waypoint_prefix_3,
-                'waypoint': 'yes'
-              }
-            ),
+            [
+                ('address',
+                 {'prefix': cls.waypoint_prefix_3,
+                  'waypoint': 'yes'
+                  }
+                 ),
 
-            #  Waypoint 1 configuration ----------------------
-            ( 'autoLink',
-              { 'address': cls.waypoint_prefix_3 + '.waypoint',
-                'containerId': cls.container_ids[3],
-                'direction': 'in'
-              }
-            ),
-            ( 'autoLink',
-              { 'address': cls.waypoint_prefix_3 + '.waypoint',
-                'containerId': cls.container_ids[3],
-                'direction': 'out'
-              }
-            ),
+                #  Waypoint 1 configuration ----------------------
+                ('autoLink',
+                 {'address': cls.waypoint_prefix_3 + '.waypoint',
+                  'containerId': cls.container_ids[3],
+                  'direction': 'in'
+                  }
+                 ),
+                ('autoLink',
+                 {'address': cls.waypoint_prefix_3 + '.waypoint',
+                  'containerId': cls.container_ids[3],
+                  'direction': 'out'
+                  }
+                 ),
 
-            #  Waypoint 2 configuration ----------------------
-            ( 'autoLink',
-              { 'address': cls.waypoint_prefix_3 + '.waypoint',
-                'containerId': cls.container_ids[3],
-                'direction': 'in'
-              }
-            ),
-            ( 'autoLink',
-              { 'address': cls.waypoint_prefix_3 + '.waypoint',
-                'containerId': cls.container_ids[3],
-                'direction': 'out'
-              }
-            )
-        ]
-
+                #  Waypoint 2 configuration ----------------------
+                ('autoLink',
+                 {'address': cls.waypoint_prefix_3 + '.waypoint',
+                  'containerId': cls.container_ids[3],
+                  'direction': 'in'
+                  }
+                 ),
+                ('autoLink',
+                 {'address': cls.waypoint_prefix_3 + '.waypoint',
+                  'containerId': cls.container_ids[3],
+                  'direction': 'out'
+                  }
+                 )
+            ]
 
         def router(name, more_config):
 
-            config = [ ('router',  {'mode': 'interior', 'id': name}),
-                       ('address', {'prefix': 'closest',   'distribution': 'closest'}),
-                       ('address', {'prefix': 'balanced',  'distribution': 'balanced'}),
-                       ('address', {'prefix': 'multicast', 'distribution': 'multicast'})
-                     ]                                 \
-                     + linkroute_configuration         \
-                     + single_waypoint_configuration   \
-                     + serial_waypoint_configuration   \
-                     + parallel_waypoint_configuration \
-                     + more_config
+            config = [('router',  {'mode': 'interior', 'id': name}),
+                      ('address', {'prefix': 'closest',   'distribution': 'closest'}),
+                      ('address', {'prefix': 'balanced',  'distribution': 'balanced'}),
+                      ('address', {'prefix': 'multicast', 'distribution': 'multicast'})
+                      ]                                 \
+                + linkroute_configuration         \
+                + single_waypoint_configuration   \
+                + serial_waypoint_configuration   \
+                + parallel_waypoint_configuration \
+                + more_config
 
             config = Qdrouterd.Config(config)
 
@@ -322,8 +316,6 @@
 
         cls.routers = []
 
-
-
         #
         #     Connection picture
         #
@@ -375,121 +367,120 @@
         cls.A_D_cost =   50
         cls.B_D_cost =  100
 
-
-        router ( 'A',
-                 [
-                    ( 'listener',
-                      { 'port': A_client_port,
-                        'role': 'normal',
-                        'stripAnnotations': 'no'
-                      }
+        router('A',
+               [
+                   ('listener',
+                    {'port': A_client_port,
+                     'role': 'normal',
+                     'stripAnnotations': 'no'
+                     }
                     ),
-                    ( 'listener',
-                      {  'role': 'inter-router',
-                         'port': A_inter_router_port_1
-                      }
+                   ('listener',
+                    {'role': 'inter-router',
+                     'port': A_inter_router_port_1
+                     }
                     ),
-                    ( 'listener',
-                      {  'role': 'inter-router',
-                         'port': A_inter_router_port_2
-                      }
+                   ('listener',
+                    {'role': 'inter-router',
+                     'port': A_inter_router_port_2
+                     }
                     ),
-                    ( 'listener',
-                      { 'port': A_route_container_port,  # route-container is listener number 3
-                        'stripAnnotations': 'no',
-                        'role': 'route-container'
-                      }
+                   ('listener',
+                    {'port': A_route_container_port,  # route-container is listener number 3
+                     'stripAnnotations': 'no',
+                     'role': 'route-container'
+                     }
                     )
-                 ]
+               ]
                )
 
-        router ( 'B',
-                 [
-                    ( 'listener',
-                      { 'port': B_client_port,
-                        'role': 'normal',
-                        'stripAnnotations': 'no'
-                      }
+        router('B',
+               [
+                   ('listener',
+                    {'port': B_client_port,
+                     'role': 'normal',
+                     'stripAnnotations': 'no'
+                     }
                     ),
-                    ( 'listener',
-                      {  'role': 'inter-router',
-                         'port': B_inter_router_port_1
-                      }
+                   ('listener',
+                    {'role': 'inter-router',
+                     'port': B_inter_router_port_1
+                     }
                     ),
-                    ( 'listener',
-                      {  'role': 'inter-router',
-                         'port': B_inter_router_port_2
-                      }
+                   ('listener',
+                    {'role': 'inter-router',
+                     'port': B_inter_router_port_2
+                     }
                     ),
-                    ( 'listener',
-                      { 'port': B_route_container_port,  # route-container is number 3
-                        'stripAnnotations': 'no',
-                        'role': 'route-container'
-                      }
+                   ('listener',
+                    {'port': B_route_container_port,  # route-container is number 3
+                     'stripAnnotations': 'no',
+                     'role': 'route-container'
+                     }
                     ),
-                    ( 'connector',
-                      {  'name': 'connectorToA',
-                         'role': 'inter-router',
-                         'port': A_inter_router_port_1,
-                         'cost':  cls.A_B_cost
-                      }
+                   ('connector',
+                    {'name': 'connectorToA',
+                     'role': 'inter-router',
+                     'port': A_inter_router_port_1,
+                     'cost': cls.A_B_cost
+                     }
                     )
-                 ]
+               ]
                )
 
-        router ( 'C',
-                 [
-                    ( 'listener',
-                      { 'port': C_client_port,
-                        'role': 'normal',
-                        'stripAnnotations': 'no'
-                      }
+        router('C',
+               [
+                   ('listener',
+                    {'port': C_client_port,
+                     'role': 'normal',
+                     'stripAnnotations': 'no'
+                     }
                     ),
-                    ( 'listener',
-                       { 'port': C_route_container_port,  # route-container is number 1
-                         'stripAnnotations': 'no',
-                         'role': 'route-container'
-                       }
+                   ('listener',
+                    {'port': C_route_container_port,  # route-container is number 1
+                     'stripAnnotations': 'no',
+                     'role': 'route-container'
+                     }
                     ),
-                    ( 'connector',
-                      {  'name': 'connectorToB',
-                         'role': 'inter-router',
-                         'port': B_inter_router_port_1,
-                         'cost' : cls.B_C_cost
-                      }
+                   ('connector',
+                    {'name': 'connectorToB',
+                     'role': 'inter-router',
+                     'port': B_inter_router_port_1,
+                     'cost' : cls.B_C_cost
+                     }
                     )
-                 ]
+               ]
                )
 
-        router ( 'D',
-                 [
-                    ( 'listener',
-                      { 'port': D_client_port,
-                        'role': 'normal',
-                        'stripAnnotations': 'no'
-                      }
+        router('D',
+               [
+                   ('listener',
+                    {'port': D_client_port,
+                     'role': 'normal',
+                     'stripAnnotations': 'no'
+                     }
                     ),
-                    ( 'listener',
-                       { 'port': D_route_container_port,  # route-container is number 1
-                         'stripAnnotations': 'no',
-                         'role': 'route-container'
-                       }
+                   ('listener',
+                    {'port': D_route_container_port,  # route-container is number 1
+                     'stripAnnotations': 'no',
+                     'role': 'route-container'
+                     }
                     ),
-                    ( 'connector',
-                      {  'name': 'connectorToA',
-                         'role': 'inter-router',
-                         'port': A_inter_router_port_2,
-                         'cost' : cls.A_D_cost
-                      }
+                   ('connector',
+                    {'name': 'connectorToA',
+                     'role': 'inter-router',
+                     'port': A_inter_router_port_2,
+                     'cost' : cls.A_D_cost
+                     }
                     ),
-                    ( 'connector',
-                      {  'name': 'connectorToB',
-                         'role': 'inter-router',
-                         'port': B_inter_router_port_2,
-                         'cost' : cls.B_D_cost
-                      }
+                   ('connector',
+                    {'name': 'connectorToB',
+                     'role': 'inter-router',
+                     'port': B_inter_router_port_2,
+                     'cost' : cls.B_D_cost
+                     }
                     )
-                 ]
+               ]
                )
 
         router_A = cls.routers[0]
@@ -511,108 +502,98 @@
         cls.C_addr = router_C.addresses[0]
         cls.D_addr = router_D.addresses[0]
 
-
     @SkipIfNeeded(DistributionSkipMapper.skip['test_01'], 'Test skipped during development.')
-    def test_01_targeted_sender_AC ( self ):
-        name='test_01'
-        test = TargetedSenderTest ( name, self.A_addr, self.C_addr, "closest/01" )
+    def test_01_targeted_sender_AC(self):
+        name = 'test_01'
+        test = TargetedSenderTest(name, self.A_addr, self.C_addr, "closest/01")
         test.run()
-        self.assertEqual ( None, test.error )
-
+        self.assertEqual(None, test.error)
 
     @SkipIfNeeded(DistributionSkipMapper.skip['test_02'], 'Test skipped during development.')
-    def test_02_targeted_sender_DC ( self ):
-        name='test_02'
-        test = TargetedSenderTest ( name, self.D_addr, self.C_addr, "closest/02" )
+    def test_02_targeted_sender_DC(self):
+        name = 'test_02'
+        test = TargetedSenderTest(name, self.D_addr, self.C_addr, "closest/02")
         test.run()
-        self.assertEqual ( None, test.error )
-
+        self.assertEqual(None, test.error)
 
     @SkipIfNeeded(DistributionSkipMapper.skip['test_03'], 'Test skipped during development.')
-    def test_03_anonymous_sender_AC ( self ):
-        name='test_03'
-        test = AnonymousSenderTest ( name, self.A_addr, self.C_addr )
+    def test_03_anonymous_sender_AC(self):
+        name = 'test_03'
+        test = AnonymousSenderTest(name, self.A_addr, self.C_addr)
         test.run()
-        self.assertEqual ( None, test.error )
-
+        self.assertEqual(None, test.error)
 
     @SkipIfNeeded(DistributionSkipMapper.skip['test_04'], 'Test skipped during development.')
-    def test_04_anonymous_sender_DC ( self ):
-        name='test_04'
-        test = AnonymousSenderTest ( name, self.D_addr, self.C_addr )
+    def test_04_anonymous_sender_DC(self):
+        name = 'test_04'
+        test = AnonymousSenderTest(name, self.D_addr, self.C_addr)
         test.run()
-        self.assertEqual ( None, test.error )
-
+        self.assertEqual(None, test.error)
 
     @SkipIfNeeded(DistributionSkipMapper.skip['test_05'], 'Test skipped during development.')
-    def test_05_dynamic_reply_to_AC ( self ):
-        name='test_05'
-        test = DynamicReplyTo ( name, self.A_addr, self.C_addr )
+    def test_05_dynamic_reply_to_AC(self):
+        name = 'test_05'
+        test = DynamicReplyTo(name, self.A_addr, self.C_addr)
         test.run()
-        self.assertEqual ( None, test.error )
-
+        self.assertEqual(None, test.error)
 
     @SkipIfNeeded(DistributionSkipMapper.skip['test_06'], 'Test skipped during development.')
-    def test_06_dynamic_reply_to_DC ( self ):
-        name='test_06'
-        test = DynamicReplyTo ( name, self.D_addr, self.C_addr )
+    def test_06_dynamic_reply_to_DC(self):
+        name = 'test_06'
+        test = DynamicReplyTo(name, self.D_addr, self.C_addr)
         test.run()
-        self.assertEqual ( None, test.error )
-
+        self.assertEqual(None, test.error)
 
     @SkipIfNeeded(DistributionSkipMapper.skip['test_07'], 'Test skipped during development.')
-    def test_07_linkroute ( self ):
-        name='test_07'
-        test = LinkAttachRouting ( name,
-                                   self.container_ids[0],
-                                   self.C_addr,
-                                   self.A_route_container_addr,
-                                   self.linkroute_prefix,
-                                   "addr_07"
+    def test_07_linkroute(self):
+        name = 'test_07'
+        test = LinkAttachRouting(name,
+                                 self.container_ids[0],
+                                 self.C_addr,
+                                 self.A_route_container_addr,
+                                 self.linkroute_prefix,
+                                 "addr_07"
                                  )
         test.run()
-        self.assertEqual ( None, test.error )
-
+        self.assertEqual(None, test.error)
 
     @SkipIfNeeded(DistributionSkipMapper.skip['test_08'], 'Test skipped during development.')
-    def test_08_linkroute_check_only ( self ):
-        name='test_08'
-        test = LinkAttachRoutingCheckOnly ( name,
-                                            self.container_ids[0],
-                                            self.C_addr,
-                                            self.A_route_container_addr,
-                                            self.linkroute_prefix,
-                                            "addr_08"
+    def test_08_linkroute_check_only(self):
+        name = 'test_08'
+        test = LinkAttachRoutingCheckOnly(name,
+                                          self.container_ids[0],
+                                          self.C_addr,
+                                          self.A_route_container_addr,
+                                          self.linkroute_prefix,
+                                          "addr_08"
                                           )
         test.run()
-        self.assertEqual ( None, test.error )
-
+        self.assertEqual(None, test.error)
 
     @SkipIfNeeded(DistributionSkipMapper.skip['test_09'], 'Test skipped during development.')
-    def test_09_closest_linear ( self ):
-        name='test_09'
-        test = ClosestTest ( name,
-                             self.A_addr,
-                             self.B_addr,
-                             self.C_addr,
-                             "addr_09",
-                             print_debug=False
+    def test_09_closest_linear(self):
+        name = 'test_09'
+        test = ClosestTest(name,
+                           self.A_addr,
+                           self.B_addr,
+                           self.C_addr,
+                           "addr_09",
+                           print_debug=False
                            )
         test.run()
-        self.assertEqual ( None, test.error )
-
+        self.assertEqual(None, test.error)
 
     @SkipIfNeeded(DistributionSkipMapper.skip['test_10'], 'Test skipped during development.')
-    def test_10_closest_mesh ( self ):
-        name='test_10'
-        test = ClosestTest ( name,
-                             self.A_addr,
-                             self.B_addr,
-                             self.D_addr,
-                             "addr_10"
+    def test_10_closest_mesh(self):
+        name = 'test_10'
+        test = ClosestTest(name,
+                           self.A_addr,
+                           self.B_addr,
+                           self.D_addr,
+                           "addr_10"
                            )
         test.run()
-        self.assertEqual ( None, test.error )
+        self.assertEqual(None, test.error)
 
         #
         #     Cost picture for balanced distribution tests.
@@ -683,8 +664,8 @@
         #
 
     @SkipIfNeeded(DistributionSkipMapper.skip['test_11'], 'Test skipped during development.')
-    def test_11_balanced_linear ( self ):
-        name='test_11'
+    def test_11_balanced_linear(self):
+        name = 'test_11'
         # slop is how much the second two values may diverge from
         # the expected.  But they still must sum to total - A.
         total      = 100
@@ -698,25 +679,24 @@
         slop = 1
         omit_middle_receiver = False
 
-        test = BalancedTest ( name,
-                              self.A_addr,
-                              self.B_addr,
-                              self.C_addr,
-                              "addr_11",
-                              total,
-                              expected_A,
-                              expected_B,
-                              expected_C,
-                              slop,
-                              omit_middle_receiver
+        test = BalancedTest(name,
+                            self.A_addr,
+                            self.B_addr,
+                            self.C_addr,
+                            "addr_11",
+                            total,
+                            expected_A,
+                            expected_B,
+                            expected_C,
+                            slop,
+                            omit_middle_receiver
                             )
         test.run()
-        self.assertEqual ( None, test.error )
-
+        self.assertEqual(None, test.error)
 
     @SkipIfNeeded(DistributionSkipMapper.skip['test_12'], 'Test skipped during development.')
-    def test_12_balanced_linear_omit_middle_receiver ( self ):
-        name='test_12'
+    def test_12_balanced_linear_omit_middle_receiver(self):
+        name = 'test_12'
         # If we omit the middle receiver, then router A will count
         # up to cost ( A, B ) and the keep counting up a further
         # cost ( B, C ) before it starts to spill over.
@@ -738,21 +718,20 @@
         slop = 1
         omit_middle_receiver = True
 
-        test = BalancedTest ( name,
-                              self.A_addr,
-                              self.B_addr,
-                              self.C_addr,
-                              "addr_12",
-                              total,
-                              expected_A,
-                              expected_B,
-                              expected_C,
-                              slop,
-                              omit_middle_receiver
+        test = BalancedTest(name,
+                            self.A_addr,
+                            self.B_addr,
+                            self.C_addr,
+                            "addr_12",
+                            total,
+                            expected_A,
+                            expected_B,
+                            expected_C,
+                            slop,
+                            omit_middle_receiver
                             )
         test.run()
-        self.assertEqual ( None, test.error )
-
+        self.assertEqual(None, test.error)
 
         #     Reasoning for the triangular balanced case:
         #
@@ -810,60 +789,58 @@
         #       2. B and D sum to 100 - A
         #       3. B and D are both with 1 of their expected values.
         #
+
     @SkipIfNeeded(DistributionSkipMapper.skip['test_13'], 'Test skipped during development.')
-    def test_13_balanced_mesh ( self ):
-        name='test_13'
+    def test_13_balanced_mesh(self):
+        name = 'test_13'
         total      = 100
         expected_A = 54
         expected_B = 43
         expected_D = 3
         slop       = 1
         omit_middle_receiver = False
-        test = BalancedTest ( name,
-                              self.A_addr,
-                              self.B_addr,
-                              self.D_addr,
-                              "addr_13",
-                              total,
-                              expected_A,
-                              expected_B,
-                              expected_D,
-                              slop,
-                              omit_middle_receiver
+        test = BalancedTest(name,
+                            self.A_addr,
+                            self.B_addr,
+                            self.D_addr,
+                            "addr_13",
+                            total,
+                            expected_A,
+                            expected_B,
+                            expected_D,
+                            slop,
+                            omit_middle_receiver
                             )
         test.run()
-        self.assertEqual ( None, test.error )
-
+        self.assertEqual(None, test.error)
 
     @SkipIfNeeded(DistributionSkipMapper.skip['test_14'], 'Test skipped during development.')
-    def test_14_multicast_linear ( self ):
-        name='test_14'
-        test = MulticastTest ( name,
-                               self.A_addr,
-                               self.B_addr,
-                               self.C_addr,
-                               "addr_14"
+    def test_14_multicast_linear(self):
+        name = 'test_14'
+        test = MulticastTest(name,
+                             self.A_addr,
+                             self.B_addr,
+                             self.C_addr,
+                             "addr_14"
                              )
         test.run()
-        self.assertEqual ( None, test.error )
-
+        self.assertEqual(None, test.error)
 
     @SkipIfNeeded(DistributionSkipMapper.skip['test_15'], 'Test skipped during development.')
-    def test_15_multicast_mesh ( self ):
-        name='test_15'
-        test = MulticastTest ( name,
-                               self.A_addr,
-                               self.B_addr,
-                               self.D_addr,
-                               "addr_15"
+    def test_15_multicast_mesh(self):
+        name = 'test_15'
+        test = MulticastTest(name,
+                             self.A_addr,
+                             self.B_addr,
+                             self.D_addr,
+                             "addr_15"
                              )
         test.run()
-        self.assertEqual ( None, test.error )
-
+        self.assertEqual(None, test.error)
 
     @SkipIfNeeded(DistributionSkipMapper.skip['test_16'], 'Test skipped during development.')
-    def test_16_linkroute_linear_all_local ( self ) :
-        name='test_16'
+    def test_16_linkroute_linear_all_local(self) :
+        name = 'test_16'
         """
         This test should route all senders' link-attaches
         to the local containers on router A.
@@ -873,10 +850,10 @@
 
         # Choose which routers to give the test.
         # This choice controls topology.  ABC is linear.
-        routers = ( self.A_route_container_addr,
-                    self.B_route_container_addr,
-                    self.C_route_container_addr
-                  )
+        routers = (self.A_route_container_addr,
+                   self.B_route_container_addr,
+                   self.C_route_container_addr
+                   )
 
         # NOTE : about these 3-tuples.
         # The positions in these tuples correspond to the routers passed
@@ -885,14 +862,14 @@
         # test make its senders.
 
         # Tell the test on which routers to make its link-container cnxs.
-        where_to_make_connections                = ( 2, 2, 2 )
-        where_the_routed_link_attaches_should_go = ( 4, 0, 0 )
+        where_to_make_connections                = (2, 2, 2)
+        where_the_routed_link_attaches_should_go = (4, 0, 0)
 
         # Tell the test how to check for the address being ready.
         n_local_containers = 2
         n_remote_routers   = 2
 
-        #-----------------------------------------------------------------------
+        # -----------------------------------------------------------------------
         # This is the instruction-list that the test looks at as various
         # milestones are met during testing. If a given event happens,
         # and if it matches the event in the current step of the instructions,
@@ -901,58 +878,56 @@
         # These instructions lists make the test more flexible, so I can get
         # different behavior without writing *almost* the same code mutiple
         # times.
-        #-----------------------------------------------------------------------
+        # -----------------------------------------------------------------------
 
         # note: if 'done' is present in an action, it always means 'succeed now'.
         # If there had been a failure, that would have been caught in an
         # earlier part of the action.
 
         instructions = [
-                         # Once the link-routable address is ready to use in
-                         # the router network, create 4 senders.
-                         {
-                           'event'  : 'address_ready',
-                           'action' : { 'fn'   : 'make_senders',
-                                         'arg' : 4
-                                      }
-                         },
-                         # In this action, the list-argument to the function
-                         # shows how we expect link-attach routes to be
-                         # distributed: 4 to the first router,
-                         # none to the other two.
-                         {
-                           'event'  : 'got_receivers',
-                           'action' : { 'fn'   : 'check_receiver_distribution',
-                                        'arg'  : where_the_routed_link_attaches_should_go,
-                                      }
-                         },
-                         {
-                           'event'  : 'receiver_distribution_ok',
-                           'action' : {'fn'    : 'none',
-                                       'done'  : 'succeed'
-                                      }
-                         }
-                       ]
+            # Once the link-routable address is ready to use in
+            # the router network, create 4 senders.
+            {
+                'event'  : 'address_ready',
+                'action' : {'fn'   : 'make_senders',
+                            'arg' : 4
+                            }
+            },
+            # In this action, the list-argument to the function
+            # shows how we expect link-attach routes to be
+            # distributed: 4 to the first router,
+            # none to the other two.
+            {
+                'event'  : 'got_receivers',
+                'action' : {'fn': 'check_receiver_distribution',
+                            'arg': where_the_routed_link_attaches_should_go,
+                            }
+            },
+            {
+                'event'  : 'receiver_distribution_ok',
+                'action' : {'fn'    : 'none',
+                            'done'  : 'succeed'
+                            }
+            }
+        ]
 
-        test = RoutingTest ( name,
-                             self.container_ids[0],
-                             self.A_addr,  # all senders are attached here
-                             routers,
-                             self.linkroute_prefix,
-                             addr_suffix,
-                             instructions,
-                             where_to_make_connections,
-                             n_local_containers,
-                             n_remote_routers
+        test = RoutingTest(name,
+                           self.container_ids[0],
+                           self.A_addr,  # all senders are attached here
+                           routers,
+                           self.linkroute_prefix,
+                           addr_suffix,
+                           instructions,
+                           where_to_make_connections,
+                           n_local_containers,
+                           n_remote_routers
                            )
-        test.run ( )
-        self.assertEqual ( None, test.error )
-
-
+        test.run()
+        self.assertEqual(None, test.error)
 
     @SkipIfNeeded(DistributionSkipMapper.skip['test_17'], 'Test skipped during development.')
-    def test_17_linkroute_linear_all_B ( self ) :
-        name='test_17'
+    def test_17_linkroute_linear_all_B(self) :
+        name = 'test_17'
         """
         This test should route all senders' link-attaches
         to the remote connections on router B.
@@ -962,10 +937,10 @@
 
         # Choose which routers to give the test.
         # This choice controls topology.  ABC is linear.
-        routers = ( self.A_route_container_addr,
-                    self.B_route_container_addr,
-                    self.C_route_container_addr
-                  )
+        routers = (self.A_route_container_addr,
+                   self.B_route_container_addr,
+                   self.C_route_container_addr
+                   )
 
         # NOTE : about these 3-tuples.
         # The positions in these tuples correspond to the routers passed
@@ -974,14 +949,14 @@
         # test make its senders.
 
         # Tell the test on which routers to make its link-container cnxs.
-        where_to_make_connections                = ( 0, 2, 2 )
-        where_the_routed_link_attaches_should_go = ( 0, 4, 0 )
+        where_to_make_connections                = (0, 2, 2)
+        where_the_routed_link_attaches_should_go = (0, 4, 0)
 
         # Tell the test how to check for the address being ready.
         n_local_containers = 0
         n_remote_routers   = 2
 
-        #-----------------------------------------------------------------------
+        # -----------------------------------------------------------------------
         # This is the instruction-list that the test looks at as various
         # milestones are met during testing. If a given event happens,
         # and if it matches the event in the current step of the instructions,
@@ -990,58 +965,56 @@
         # These instructions lists make the test more flexible, so I can get
         # different behavior without writing *almost* the same code mutiple
         # times.
-        #-----------------------------------------------------------------------
+        # -----------------------------------------------------------------------
 
         # note: if 'done' is present in an action, it always means 'succeed now'.
         # If there had been a failure, that would have been caught in an
         # earlier part of the action.
 
         instructions = [
-                         # Once the link-routable address is ready to use in
-                         # the router network, create 4 senders.
-                         {
-                           'event'  : 'address_ready',
-                           'action' : { 'fn'   : 'make_senders',
-                                         'arg' : 4
-                                      }
-                         },
-                         # In this action, the list-argument to the function
-                         # shows how we expect link-attach routes to be
-                         # distributed: 4 to router B,
-                         # none anywhere else.
-                         {
-                           'event'  : 'got_receivers',
-                           'action' : { 'fn'   : 'check_receiver_distribution',
-                                        'arg'  : where_the_routed_link_attaches_should_go,
-                                      }
-                         },
-                         {
-                           'event'  : 'receiver_distribution_ok',
-                           'action' : {'fn'    : 'none',
-                                       'done'  : 'succeed'
-                                      }
-                         }
-                       ]
+            # Once the link-routable address is ready to use in
+            # the router network, create 4 senders.
+            {
+                'event'  : 'address_ready',
+                'action' : {'fn'   : 'make_senders',
+                            'arg' : 4
+                            }
+            },
+            # In this action, the list-argument to the function
+            # shows how we expect link-attach routes to be
+            # distributed: 4 to router B,
+            # none anywhere else.
+            {
+                'event'  : 'got_receivers',
+                'action' : {'fn': 'check_receiver_distribution',
+                            'arg': where_the_routed_link_attaches_should_go,
+                            }
+            },
+            {
+                'event'  : 'receiver_distribution_ok',
+                'action' : {'fn'    : 'none',
+                            'done'  : 'succeed'
+                            }
+            }
+        ]
 
-        test = RoutingTest ( name,
-                             self.container_ids[0],
-                             self.A_addr,  # all senders are attached here
-                             routers,
-                             self.linkroute_prefix,
-                             addr_suffix,
-                             instructions,
-                             where_to_make_connections,
-                             n_local_containers,
-                             n_remote_routers
+        test = RoutingTest(name,
+                           self.container_ids[0],
+                           self.A_addr,  # all senders are attached here
+                           routers,
+                           self.linkroute_prefix,
+                           addr_suffix,
+                           instructions,
+                           where_to_make_connections,
+                           n_local_containers,
+                           n_remote_routers
                            )
-        test.run ( )
-        self.assertEqual ( None, test.error )
-
-
+        test.run()
+        self.assertEqual(None, test.error)
 
     @SkipIfNeeded(DistributionSkipMapper.skip['test_18'], 'Test skipped during development.')
-    def test_18_linkroute_linear_all_C ( self ) :
-        name='test_18'
+    def test_18_linkroute_linear_all_C(self) :
+        name = 'test_18'
         """
         This test should route all senders' link-attaches
         to the remote connections on router C.
@@ -1051,10 +1024,10 @@
 
         # Choose which routers to give the test.
         # This choice controls topology.  ABC is linear.
-        routers = ( self.A_route_container_addr,
-                    self.B_route_container_addr,
-                    self.C_route_container_addr
-                  )
+        routers = (self.A_route_container_addr,
+                   self.B_route_container_addr,
+                   self.C_route_container_addr
+                   )
 
         # NOTE : about these 3-tuples.
         # The positions in these tuples correspond to the routers passed
@@ -1063,14 +1036,14 @@
         # test make its senders.
 
         # Tell the test on which routers to make its link-container cnxs.
-        where_to_make_connections                = ( 0, 0, 2 )
-        where_the_routed_link_attaches_should_go = ( 0, 0, 4 )
+        where_to_make_connections                = (0, 0, 2)
+        where_the_routed_link_attaches_should_go = (0, 0, 4)
 
         # Tell the test how to check for the address being ready.
         n_local_containers = 0
         n_remote_routers   = 1
 
-        #-----------------------------------------------------------------------
+        # -----------------------------------------------------------------------
         # This is the instruction-list that the test looks at as various
         # milestones are met during testing. If a given event happens,
         # and if it matches the event in the current step of the instructions,
@@ -1079,57 +1052,56 @@
         # These instructions lists make the test more flexible, so I can get
         # different behavior without writing *almost* the same code mutiple
         # times.
-        #-----------------------------------------------------------------------
+        # -----------------------------------------------------------------------
 
         # note: if 'done' is present in an action, it always means 'succeed now'.
         # If there had been a failure, that would have been caught in an
         # earlier part of the action.
 
         instructions = [
-                         # Once the link-routable address is ready to use in
-                         # the router network, create 4 senders.
-                         {
-                           'event'  : 'address_ready',
-                           'action' : { 'fn'   : 'make_senders',
-                                         'arg' : 4
-                                      }
-                         },
-                         # In this action, the list-argument to the function
-                         # shows how we expect link-attach routes to be
-                         # distributed: 4 to router B,
-                         # none anywhere else.
-                         {
-                           'event'  : 'got_receivers',
-                           'action' : { 'fn'   : 'check_receiver_distribution',
-                                        'arg'  : where_the_routed_link_attaches_should_go
-                                      }
-                         },
-                         {
-                           'event'  : 'receiver_distribution_ok',
-                           'action' : {'fn'    : 'none',
-                                       'done'  : 'succeed'
-                                      }
-                         }
-                       ]
+            # Once the link-routable address is ready to use in
+            # the router network, create 4 senders.
+            {
+                'event'  : 'address_ready',
+                'action' : {'fn'   : 'make_senders',
+                            'arg' : 4
+                            }
+            },
+            # In this action, the list-argument to the function
+            # shows how we expect link-attach routes to be
+            # distributed: 4 to router B,
+            # none anywhere else.
+            {
+                'event'  : 'got_receivers',
+                'action' : {'fn'   : 'check_receiver_distribution',
+                            'arg'  : where_the_routed_link_attaches_should_go
+                            }
+            },
+            {
+                'event'  : 'receiver_distribution_ok',
+                'action' : {'fn'    : 'none',
+                            'done'  : 'succeed'
+                            }
+            }
+        ]
 
-        test = RoutingTest ( name,
-                             self.container_ids[0],
-                             self.A_addr,  # all senders are attached here
-                             routers,
-                             self.linkroute_prefix,
-                             addr_suffix,
-                             instructions,
-                             where_to_make_connections,
-                             n_local_containers,
-                             n_remote_routers
+        test = RoutingTest(name,
+                           self.container_ids[0],
+                           self.A_addr,  # all senders are attached here
+                           routers,
+                           self.linkroute_prefix,
+                           addr_suffix,
+                           instructions,
+                           where_to_make_connections,
+                           n_local_containers,
+                           n_remote_routers
                            )
-        test.run ( )
-        self.assertEqual ( None, test.error )
-
+        test.run()
+        self.assertEqual(None, test.error)
 
     @SkipIfNeeded(DistributionSkipMapper.skip['test_19'], 'Test skipped during development.')
-    def test_19_linkroute_linear_kill ( self ) :
-        name='test_19'
+    def test_19_linkroute_linear_kill(self) :
+        name = 'test_19'
         """
         Start out as usual, making four senders and seeing their link-attaches
         routed to router A (local). But then kill the two route-container
@@ -1141,10 +1113,10 @@
 
         # Choose which routers to give the test.
         # This choice controls topology.  ABC is linear.
-        routers = ( self.A_route_container_addr,
-                    self.B_route_container_addr,
-                    self.C_route_container_addr
-                  )
+        routers = (self.A_route_container_addr,
+                   self.B_route_container_addr,
+                   self.C_route_container_addr
+                   )
 
         # NOTE : about these 3-tuples.
         # The positions in these tuples correspond to the routers passed
@@ -1153,18 +1125,18 @@
         # test make its senders.
 
         # Tell the test on which routers to make its link-container cnxs.
-        where_to_make_connections = ( 2, 2, 2 )
+        where_to_make_connections = (2, 2, 2)
 
         # And where to expect the resulting link-attaches to end up.
-        first_4                   = ( 4, 0, 0 )   # All go to A
-        second_4                  = ( 4, 4, 0 )   # New ones go to B
-        third_4                   = ( 4, 4, 4 )   # New ones go to C
+        first_4                   = (4, 0, 0)   # All go to A
+        second_4                  = (4, 4, 0)   # New ones go to B
+        third_4                   = (4, 4, 4)   # New ones go to C
 
         # Tell the test how to check for the address being ready.
         n_local_containers = 0
         n_remote_routers   = 2
 
-        #-----------------------------------------------------------------------
+        # -----------------------------------------------------------------------
         # This is the instruction-list that the test looks at as various
         # milestones are met during testing. If a given event happens,
         # and if it matches the event in the current step of the instructions,
@@ -1173,112 +1145,110 @@
         # These instructions lists make the test more flexible, so I can get
         # different behavior without writing *almost* the same code mutiple
         # times.
-        #-----------------------------------------------------------------------
+        # -----------------------------------------------------------------------
 
         # note: if 'done' is present in an action, it always means 'succeed now'.
         # If there had been a failure, that would have been caught in an
         # earlier part of the action.
 
         instructions = [
-                         # Once the link-routable address is ready to use in
-                         # the router network, create 4 senders.
-                         {
-                           'event'  : 'address_ready',
-                           'action' : { 'fn'   : 'make_senders',
-                                        'arg'  : 4
-                                      }
-                         },
-                         # Check the distribution of the first four
-                         # link-attach routings, then go immediately
-                         # to the next instruction step.
-                         {
-                           'event'  : 'got_receivers',
-                           'action' : { 'fn'   : 'check_receiver_distribution',
-                                        'arg'  : first_4
-                                      }
-                         },
-                         # After we see that the first 4 senders have
-                         # had their link-attaches routed to the right place,
-                         # (which will be router A), close all route-container
-                         # connections to that router.
-                         {
-                           'event'  : 'receiver_distribution_ok',
-                           'action' : { 'fn'   : 'kill_connections',
-                                        'arg'  : 0
-                                      }
-                         },
-                         # Once the route-container connections on A are
-                         # closed, make 4 new senders
-                         {
-                           'event'  : 'connections_closed',
-                           'action' : { 'fn'   : 'make_senders',
-                                        'arg'  : 4
-                                      }
-                         },
-                         # The link-attaches from these 4 new senders
-                         # should now all have gone to the route-container
-                         # connections on router B.
-                         {
-                           'event'  : 'got_receivers',
-                           'action' : { 'fn'   : 'check_receiver_distribution',
-                                        'arg'  : second_4
-                                      }
-                         },
-                         # If we receive confirmation that the link-attaches
-                         # have gone to the right place, now we kill
-                         # connections on router B.
-                         {
-                           'event'  : 'receiver_distribution_ok',
-                           'action' : { 'fn'   : 'kill_connections',
-                                        'arg'  : 1
-                                      }
-                         },
-                         # Once the route-container connections on B are
-                         # closed, make 4 new senders
-                         {
-                           'event'  : 'connections_closed',
-                           'action' : { 'fn'   : 'make_senders',
-                                        'arg'  : 4
-                                      }
-                         },
-                         # The link-attaches from these 4 new senders
-                         # should now all have gone to the route-container
-                         # connections on router C.
-                         {
-                           'event'  : 'got_receivers',
-                           'action' : { 'fn'   : 'check_receiver_distribution',
-                                        'arg'  : third_4
-                                      }
-                         },
-                         # If we receive confirmation that the link-attaches
-                         # have gone to the right place, we succeed.
-                         {
-                           'event'  : 'receiver_distribution_ok',
-                           'action' : { 'fn'   : 'none',
-                                        'done' : 'succeed'
-                                      }
-                         }
-                       ]
+            # Once the link-routable address is ready to use in
+            # the router network, create 4 senders.
+            {
+                'event'  : 'address_ready',
+                'action' : {'fn'   : 'make_senders',
+                            'arg'  : 4
+                            }
+            },
+            # Check the distribution of the first four
+            # link-attach routings, then go immediately
+            # to the next instruction step.
+            {
+                'event'  : 'got_receivers',
+                'action' : {'fn'   : 'check_receiver_distribution',
+                            'arg'  : first_4
+                            }
+            },
+            # After we see that the first 4 senders have
+            # had their link-attaches routed to the right place,
+            # (which will be router A), close all route-container
+            # connections to that router.
+            {
+                'event'  : 'receiver_distribution_ok',
+                'action' : {'fn'   : 'kill_connections',
+                            'arg'  : 0
+                            }
+            },
+            # Once the route-container connections on A are
+            # closed, make 4 new senders
+            {
+                'event'  : 'connections_closed',
+                'action' : {'fn'   : 'make_senders',
+                            'arg'  : 4
+                            }
+            },
+            # The link-attaches from these 4 new senders
+            # should now all have gone to the route-container
+            # connections on router B.
+            {
+                'event'  : 'got_receivers',
+                'action' : {'fn'   : 'check_receiver_distribution',
+                            'arg'  : second_4
+                            }
+            },
+            # If we receive confirmation that the link-attaches
+            # have gone to the right place, now we kill
+            # connections on router B.
+            {
+                'event'  : 'receiver_distribution_ok',
+                'action' : {'fn'   : 'kill_connections',
+                            'arg'  : 1
+                            }
+            },
+            # Once the route-container connections on B are
+            # closed, make 4 new senders
+            {
+                'event'  : 'connections_closed',
+                'action' : {'fn'   : 'make_senders',
+                            'arg'  : 4
+                            }
+            },
+            # The link-attaches from these 4 new senders
+            # should now all have gone to the route-container
+            # connections on router C.
+            {
+                'event'  : 'got_receivers',
+                'action' : {'fn'   : 'check_receiver_distribution',
+                            'arg'  : third_4
+                            }
+            },
+            # If we receive confirmation that the link-attaches
+            # have gone to the right place, we succeed.
+            {
+                'event'  : 'receiver_distribution_ok',
+                'action' : {'fn'   : 'none',
+                            'done' : 'succeed'
+                            }
+            }
+        ]
 
-        test = RoutingTest ( name,
-                             self.container_ids[0],
-                             self.A_addr,  # all senders are attached here
-                             routers,
-                             self.linkroute_prefix,
-                             addr_suffix,
-                             instructions,
-                             where_to_make_connections,
-                             n_local_containers,
-                             n_remote_routers
+        test = RoutingTest(name,
+                           self.container_ids[0],
+                           self.A_addr,  # all senders are attached here
+                           routers,
+                           self.linkroute_prefix,
+                           addr_suffix,
+                           instructions,
+                           where_to_make_connections,
+                           n_local_containers,
+                           n_remote_routers
                            )
-        test.run ( )
-        self.assertEqual ( None, test.error )
-
-
+        test.run()
+        self.assertEqual(None, test.error)
 
     @SkipIfNeeded(DistributionSkipMapper.skip['test_20'], 'Test skipped during development.')
-    def test_20_linkroute_mesh_all_local ( self ) :
-        name='test_20'
+    def test_20_linkroute_mesh_all_local(self) :
+        name = 'test_20'
         #
         #                c           c
         # senders --->   A --------- B
@@ -1301,10 +1271,10 @@
         # Choose which routers to give the test.
         # This choice controls topology.  ABD is triangular,
         # i.e. 3-mesh.
-        routers = ( self.A_route_container_addr,
-                    self.B_route_container_addr,
-                    self.D_route_container_addr
-                  )
+        routers = (self.A_route_container_addr,
+                   self.B_route_container_addr,
+                   self.D_route_container_addr
+                   )
 
         # NOTE : about these 3-tuples.
         # The positions in these tuples correspond to the routers passed
@@ -1313,14 +1283,14 @@
         # test make its senders.
 
         # Tell the test on which routers to make its link-container cnxs.
-        where_to_make_connections                = ( 2, 2, 2 )
-        where_the_routed_link_attaches_should_go = ( 4, 0, 0 )
+        where_to_make_connections                = (2, 2, 2)
+        where_the_routed_link_attaches_should_go = (4, 0, 0)
 
         # Tell the test how to check for the address being ready.
         n_local_containers = 2
         n_remote_routers   = 2
 
-        #-----------------------------------------------------------------------
+        # -----------------------------------------------------------------------
         # This is the instruction-list that the test looks at as various
         # milestones are met during testing. If a given event happens,
         # and if it matches the event in the current step of the instructions,
@@ -1329,57 +1299,56 @@
         # These instructions lists make the test more flexible, so I can get
         # different behavior without writing *almost* the same code mutiple
         # times.
-        #-----------------------------------------------------------------------
+        # -----------------------------------------------------------------------
 
         # note: if 'done' is present in an action, it always means 'succeed now'.
         # If there had been a failure, that would have been caught in an
         # earlier part of the action.
 
         instructions = [
-                         # Once the link-routable address is ready to use in
-                         # the router network, create 4 senders.
-                         {
-                           'event'  : 'address_ready',
-                           'action' : { 'fn'   : 'make_senders',
-                                         'arg' : 4
-                                      }
-                         },
-                         # In this action, the list-argument to the function
-                         # shows how we expect link-attach routes to be
-                         # distributed: 4 to the first router,
-                         # none to the other two.
-                         {
-                           'event'  : 'got_receivers',
-                           'action' : { 'fn'   : 'check_receiver_distribution',
-                                        'arg'  : where_the_routed_link_attaches_should_go,
-                                      }
-                         },
-                         {
-                           'event'  : 'receiver_distribution_ok',
-                           'action' : {'fn'    : 'none',
-                                       'done'  : 'succeed'
-                                      }
-                         }
-                       ]
+            # Once the link-routable address is ready to use in
+            # the router network, create 4 senders.
+            {
+                'event'  : 'address_ready',
+                'action' : {'fn'   : 'make_senders',
+                            'arg' : 4
+                            }
+            },
+            # In this action, the list-argument to the function
+            # shows how we expect link-attach routes to be
+            # distributed: 4 to the first router,
+            # none to the other two.
+            {
+                'event'  : 'got_receivers',
+                'action' : {'fn': 'check_receiver_distribution',
+                            'arg': where_the_routed_link_attaches_should_go,
+                            }
+            },
+            {
+                'event'  : 'receiver_distribution_ok',
+                'action' : {'fn'    : 'none',
+                            'done'  : 'succeed'
+                            }
+            }
+        ]
 
-        test = RoutingTest ( name,
-                             self.container_ids[0],
-                             self.A_addr,  # all senders are attached here
-                             routers,
-                             self.linkroute_prefix,
-                             addr_suffix,
-                             instructions,
-                             where_to_make_connections,
-                             n_local_containers,
-                             n_remote_routers
+        test = RoutingTest(name,
+                           self.container_ids[0],
+                           self.A_addr,  # all senders are attached here
+                           routers,
+                           self.linkroute_prefix,
+                           addr_suffix,
+                           instructions,
+                           where_to_make_connections,
+                           n_local_containers,
+                           n_remote_routers
                            )
-        test.run ( )
-        self.assertEqual ( None, test.error )
-
+        test.run()
+        self.assertEqual(None, test.error)
 
     @SkipIfNeeded(DistributionSkipMapper.skip['test_21'], 'Test skipped during development.')
-    def test_21_linkroute_mesh_nonlocal ( self ) :
-        name='test_21'
+    def test_21_linkroute_mesh_nonlocal(self) :
+        name = 'test_21'
         #
         #                            c
         # senders --->   A --------- B
@@ -1402,10 +1371,10 @@
         # Choose which routers to give the test.
         # This choice controls topology.  ABD is triangular
         # i.e. 3-mesh.
-        routers = ( self.A_route_container_addr,
-                    self.B_route_container_addr,
-                    self.D_route_container_addr
-                  )
+        routers = (self.A_route_container_addr,
+                   self.B_route_container_addr,
+                   self.D_route_container_addr
+                   )
 
         # NOTE : about these 3-tuples.
         # The positions in these tuples correspond to the routers passed
@@ -1414,14 +1383,14 @@
         # test make its senders.
 
         # Tell the test on which routers to make its link-container cnxs.
-        where_to_make_connections                = ( 0, 2, 2 )
-        where_the_routed_link_attaches_should_go = ( 0, 2, 2 )
+        where_to_make_connections                = (0, 2, 2)
+        where_the_routed_link_attaches_should_go = (0, 2, 2)
 
         # Tell the test how to check for the address being ready.
         n_local_containers = 0
         n_remote_routers   = 2
 
-        #-----------------------------------------------------------------------
+        # -----------------------------------------------------------------------
         # This is the instruction-list that the test looks at as various
         # milestones are met during testing. If a given event happens,
         # and if it matches the event in the current step of the instructions,
@@ -1430,59 +1399,56 @@
         # These instructions lists make the test more flexible, so I can get
         # different behavior without writing *almost* the same code mutiple
         # times.
-        #-----------------------------------------------------------------------
+        # -----------------------------------------------------------------------
 
         # note: if 'done' is present in an action, it always means 'succeed now'.
         # If there had been a failure, that would have been caught in an
         # earlier part of the action.
 
         instructions = [
-                         # Once the link-routable address is ready to use in
-                         # the router network, create 4 senders.
-                         {
-                           'event'  : 'address_ready',
-                           'action' : { 'fn'   : 'make_senders',
-                                         'arg' : 4
-                                      }
-                         },
-                         # In this action, the list-argument to the function
-                         # shows how we expect link-attach routes to be
-                         # distributed: 4 to router B,
-                         # none anywhere else.
-                         {
-                           'event'  : 'got_receivers',
-                           'action' : { 'fn'   : 'check_receiver_distribution',
-                                        'arg'  : where_the_routed_link_attaches_should_go,
-                                      }
-                         },
-                         {
-                           'event'  : 'receiver_distribution_ok',
-                           'action' : {'fn'    : 'none',
-                                       'done'  : 'succeed'
-                                      }
-                         }
-                       ]
+            # Once the link-routable address is ready to use in
+            # the router network, create 4 senders.
+            {
+                'event'  : 'address_ready',
+                'action' : {'fn'   : 'make_senders',
+                            'arg' : 4
+                            }
+            },
+            # In this action, the list-argument to the function
+            # shows how we expect link-attach routes to be
+            # distributed: 4 to router B,
+            # none anywhere else.
+            {
+                'event'  : 'got_receivers',
+                'action' : {'fn': 'check_receiver_distribution',
+                            'arg': where_the_routed_link_attaches_should_go,
+                            }
+            },
+            {
+                'event'  : 'receiver_distribution_ok',
+                'action' : {'fn'    : 'none',
+                            'done'  : 'succeed'
+                            }
+            }
+        ]
 
-        test = RoutingTest ( name,
-                             self.container_ids[0],
-                             self.A_addr,  # all senders are attached here
-                             routers,
-                             self.linkroute_prefix,
-                             addr_suffix,
-                             instructions,
-                             where_to_make_connections,
-                             n_local_containers,
-                             n_remote_routers
+        test = RoutingTest(name,
+                           self.container_ids[0],
+                           self.A_addr,  # all senders are attached here
+                           routers,
+                           self.linkroute_prefix,
+                           addr_suffix,
+                           instructions,
+                           where_to_make_connections,
+                           n_local_containers,
+                           n_remote_routers
                            )
-        test.run ( )
-        self.assertEqual ( None, test.error )
-
-
-
+        test.run()
+        self.assertEqual(None, test.error)
 
     @SkipIfNeeded(DistributionSkipMapper.skip['test_22'], 'Test skipped during development.')
-    def test_22_linkroute_mesh_kill ( self ) :
-        name='test_22'
+    def test_22_linkroute_mesh_kill(self) :
+        name = 'test_22'
 
         #               c           c
         # senders --->   A --------- B
@@ -1502,10 +1468,10 @@
         # Choose which routers to give the test.
         # This choice controls topology.  ABD is triangular
         # i.e. 3-mesh.
-        routers = ( self.A_route_container_addr,
-                    self.B_route_container_addr,
-                    self.D_route_container_addr
-                  )
+        routers = (self.A_route_container_addr,
+                   self.B_route_container_addr,
+                   self.D_route_container_addr
+                   )
 
         # NOTE : about these 3-tuples.
         # The positions in these tuples correspond to the routers passed
@@ -1514,16 +1480,16 @@
         # test make its senders.
 
         # Tell the test on which routers to make its link-container cnxs.
-        where_to_make_connections = ( 2, 2, 2 )
-        first_four                = ( 4, 0, 0 )
-        second_four               = ( 4, 2, 2 )
-        third_four                = ( 4, 2, 6 )
+        where_to_make_connections = (2, 2, 2)
+        first_four                = (4, 0, 0)
+        second_four               = (4, 2, 2)
+        third_four                = (4, 2, 6)
 
         # Tell the test how to check for the address being ready.
         n_local_containers = 1
         n_remote_routers   = 2
 
-        #-----------------------------------------------------------------------
+        # -----------------------------------------------------------------------
         # This is the instruction-list that the test looks at as various
         # milestones are met during testing. If a given event happens,
         # and if it matches the event in the current step of the instructions,
@@ -1532,172 +1498,170 @@
         # These instructions lists make the test more flexible, so I can get
         # different behavior without writing *almost* the same code mutiple
         # times.
-        #-----------------------------------------------------------------------
+        # -----------------------------------------------------------------------
 
         # note: if 'done' is present in an action, it always means 'succeed now'.
         # If there had been a failure, that would have been caught in an
         # earlier part of the action.
 
         instructions = [
-                         # Once the link-routable address is ready to use in
-                         # the router network, create 4 senders.
-                         {
-                           'event'  : 'address_ready',
-                           'action' : { 'fn'   : 'make_senders',
-                                         'arg' : 4
-                                      }
-                         },
-                         # In this action, the list-argument to the function
-                         # shows how we expect link-attach routes to be
-                         # distributed: 4 to router B,
-                         # none anywhere else.
-                         {
-                           'event'  : 'got_receivers',
-                           'action' : { 'fn'   : 'check_receiver_distribution',
-                                        'arg'  : first_four,
-                                      }
-                         },
-                         # After we see that the first 4 senders have
-                         # had their link-attaches routed to the right place,
-                         # (which will be router A), close all route-container
-                         # connections to that router.
-                         {
-                           'event'  : 'receiver_distribution_ok',
-                           'action' : { 'fn'   : 'kill_connections',
-                                        'arg'  : 0
-                                      }
-                         },
-                         # Once the route-container connections on A are
-                         # closed, make 4 new senders
-                         {
-                           'event'  : 'connections_closed',
-                           'action' : { 'fn'   : 'make_senders',
-                                        'arg'  : 4
-                                      }
-                         },
-                         # The link-attaches from these 4 new senders
-                         # should now all have gone to the route-container
-                         # connections on router B.
-                         {
-                           'event'  : 'got_receivers',
-                           'action' : { 'fn'   : 'check_receiver_distribution',
-                                        'arg'  : second_four
-                                      }
-                         },
-                         # If we receive confirmation that the link-attaches
-                         # have gone to the right place, we ruthlessly
-                         # kill the next set of connections. Will we stop at
-                         # nothing to defeat this code ?!??!?
-                         {
-                           'event'  : 'receiver_distribution_ok',
-                           'action' : { 'fn'   : 'kill_connections',
-                                        'arg'  : 1
-                                      }
-                         },
-                         # Once the route-container connections on B are
-                         # closed, make 4 new senders
-                         {
-                           'event'  : 'connections_closed',
-                           'action' : { 'fn'   : 'make_senders',
-                                        'arg'  : 4
-                                      }
-                         },
-                         # The link-attaches from these 4 new senders
-                         # should now all have gone to the route-container
-                         # connections on router C.
-                         {
-                           'event'  : 'got_receivers',
-                           'action' : { 'fn'   : 'check_receiver_distribution',
-                                        'arg'  : third_four
-                                      }
-                         },
-                         # If we receive confirmation that the link-attaches
-                         # have gone to the right place, we succeed.
-                         {
-                           'event'  : 'receiver_distribution_ok',
-                           'action' : { 'fn'   : 'none',
-                                        'done' : 'succeed'
-                                      }
-                         }
-                       ]
+            # Once the link-routable address is ready to use in
+            # the router network, create 4 senders.
+            {
+                'event'  : 'address_ready',
+                'action' : {'fn'   : 'make_senders',
+                            'arg' : 4
+                            }
+            },
+            # In this action, the list-argument to the function
+            # shows how we expect link-attach routes to be
+            # distributed: 4 to router B,
+            # none anywhere else.
+            {
+                'event'  : 'got_receivers',
+                'action' : {'fn': 'check_receiver_distribution',
+                            'arg': first_four,
+                            }
+            },
+            # After we see that the first 4 senders have
+            # had their link-attaches routed to the right place,
+            # (which will be router A), close all route-container
+            # connections to that router.
+            {
+                'event'  : 'receiver_distribution_ok',
+                'action' : {'fn'   : 'kill_connections',
+                            'arg'  : 0
+                            }
+            },
+            # Once the route-container connections on A are
+            # closed, make 4 new senders
+            {
+                'event'  : 'connections_closed',
+                'action' : {'fn'   : 'make_senders',
+                            'arg'  : 4
+                            }
+            },
+            # The link-attaches from these 4 new senders
+            # should now all have gone to the route-container
+            # connections on router B.
+            {
+                'event'  : 'got_receivers',
+                'action' : {'fn'   : 'check_receiver_distribution',
+                            'arg'  : second_four
+                            }
+            },
+            # If we receive confirmation that the link-attaches
+            # have gone to the right place, we ruthlessly
+            # kill the next set of connections. Will we stop at
+            # nothing to defeat this code ?!??!?
+            {
+                'event'  : 'receiver_distribution_ok',
+                'action' : {'fn'   : 'kill_connections',
+                            'arg'  : 1
+                            }
+            },
+            # Once the route-container connections on B are
+            # closed, make 4 new senders
+            {
+                'event'  : 'connections_closed',
+                'action' : {'fn'   : 'make_senders',
+                            'arg'  : 4
+                            }
+            },
+            # The link-attaches from these 4 new senders
+            # should now all have gone to the route-container
+            # connections on router C.
+            {
+                'event'  : 'got_receivers',
+                'action' : {'fn'   : 'check_receiver_distribution',
+                            'arg'  : third_four
+                            }
+            },
+            # If we receive confirmation that the link-attaches
+            # have gone to the right place, we succeed.
+            {
+                'event'  : 'receiver_distribution_ok',
+                'action' : {'fn'   : 'none',
+                            'done' : 'succeed'
+                            }
+            }
+        ]
 
-        test = RoutingTest ( name,
-                             self.container_ids[0],
-                             self.A_addr,  # all senders are attached here
-                             routers,
-                             self.linkroute_prefix,
-                             addr_suffix,
-                             instructions,
-                             where_to_make_connections,
-                             n_local_containers,
-                             n_remote_routers
+        test = RoutingTest(name,
+                           self.container_ids[0],
+                           self.A_addr,  # all senders are attached here
+                           routers,
+                           self.linkroute_prefix,
+                           addr_suffix,
+                           instructions,
+                           where_to_make_connections,
+                           n_local_containers,
+                           n_remote_routers
                            )
-        test.run ( )
-        self.assertEqual ( None, test.error )
-
+        test.run()
+        self.assertEqual(None, test.error)
 
     @SkipIfNeeded(DistributionSkipMapper.skip['test_23'], 'Test skipped during development.')
-    def test_23_waypoint ( self ) :
-        name='test_23'
-        test = WaypointTest ( name,
-                              self.container_ids[1],
-                              self.A_addr,
-                              self.B_addr,
-                              self.C_route_container_addr,
-                              self.waypoint_prefix_1 + '.waypoint'
+    def test_23_waypoint(self) :
+        name = 'test_23'
+        test = WaypointTest(name,
+                            self.container_ids[1],
+                            self.A_addr,
+                            self.B_addr,
+                            self.C_route_container_addr,
+                            self.waypoint_prefix_1 + '.waypoint'
                             )
         test.run()
         self.assertEqual(None, test.error)
 
-
     @SkipIfNeeded(DistributionSkipMapper.skip['test_24'], 'Test skipped during development.')
-    def test_24_serial_waypoint_test ( self ):
-        name='test_24'
-        test = SerialWaypointTest ( name,
-                                    self.container_ids[2],
-                                    self.A_addr,
-                                    self.B_addr,
-                                    self.C_route_container_addr,
-                                    self.waypoint_prefix_2 + '.waypoint'
+    def test_24_serial_waypoint_test(self):
+        name = 'test_24'
+        test = SerialWaypointTest(name,
+                                  self.container_ids[2],
+                                  self.A_addr,
+                                  self.B_addr,
+                                  self.C_route_container_addr,
+                                  self.waypoint_prefix_2 + '.waypoint'
                                   )
         test.run()
         self.assertEqual(None, test.error)
 
     @SkipIfNeeded(DistributionSkipMapper.skip['test_25'], 'Test skipped during development.')
-    def test_25_parallel_waypoint_test ( self ):
-        name='test_25'
-        test = ParallelWaypointTest ( name,
-                                      self.container_ids[3],
-                                      self.A_addr,
-                                      self.B_addr,
-                                      self.C_route_container_addr,
-                                      self.waypoint_prefix_3 + '.waypoint'
+    def test_25_parallel_waypoint_test(self):
+        name = 'test_25'
+        test = ParallelWaypointTest(name,
+                                    self.container_ids[3],
+                                    self.A_addr,
+                                    self.B_addr,
+                                    self.C_route_container_addr,
+                                    self.waypoint_prefix_3 + '.waypoint'
                                     )
         test.run()
         self.assertEqual(None, test.error)
 
 
-
-
-
-#================================================================
+# ================================================================
 #     Tests
-#================================================================
-
+# ================================================================
 next_link_sequence = 1
+
+
 def link_name():
     global next_link_sequence
     name = "link-name.%d" % next_link_sequence
     next_link_sequence += 1
     return name
 
-class TargetedSenderTest ( MessagingHandler ):
+
+class TargetedSenderTest (MessagingHandler):
     """
     A 'targeted' sender is one in which we tell the router what
     address we want to send to. (As opposed to letting the router
     pass back an address to us.)
     """
-    def __init__ ( self, test_name, send_addr, recv_addr, destination ):
+
+    def __init__(self, test_name, send_addr, recv_addr, destination):
         super(TargetedSenderTest, self).__init__(prefetch=0)
         self.send_addr  = send_addr
         self.recv_addr  = recv_addr
@@ -1711,14 +1675,12 @@
         self.n_accepted = 0
         self.test_name = test_name
 
-
     def timeout(self):
         self.error = "Timeout Expired: n_sent=%d n_received=%d n_accepted=%d" % \
                      (self.n_sent, self.n_received, self.n_accepted)
         self.send_conn.close()
         self.recv_conn.close()
 
-
     def on_start(self, event):
         self.timer = event.reactor.schedule(TIMEOUT, TestTimeout(self))
         self.send_conn = event.container.connect(self.send_addr)
@@ -1727,23 +1689,19 @@
         self.receiver = event.container.create_receiver(self.recv_conn, self.dest)
         self.receiver.flow(self.n_expected)
 
-
     def send(self):
-      while self.sender.credit > 0 and self.n_sent < self.n_expected:
-        msg = Message(body=self.n_sent)
-        self.sender.send(msg)
-        self.n_sent += 1
-
+        while self.sender.credit > 0 and self.n_sent < self.n_expected:
+            msg = Message(body=self.n_sent)
+            self.sender.send(msg)
+            self.n_sent += 1
 
     def on_sendable(self, event):
         if self.n_sent < self.n_expected:
             self.send()
 
-
     def on_accepted(self, event):
         self.n_accepted += 1
 
-
     def on_message(self, event):
         self.n_received += 1
         if self.n_received == self.n_expected:
@@ -1752,12 +1710,10 @@
             self.recv_conn.close()
             self.timer.cancel()
 
-
     def run(self):
         Container(self).run()
 
 
-
 class DynamicTarget(LinkOption):
 
     def apply(self, link):
@@ -1765,8 +1721,7 @@
         link.target.address = None
 
 
-
-class AnonymousSenderTest ( MessagingHandler ):
+class AnonymousSenderTest (MessagingHandler):
     """
     An 'anonymous' sender is one in which we let the router tell
     us what address the sender should use.  It will pass back this
@@ -1791,44 +1746,37 @@
         self.n_accepted = 0
         self.test_name  = test_name
 
-
-    def timeout ( self ):
+    def timeout(self):
         self.error = "Timeout Expired: n_sent=%d n_received=%d n_accepted=%d" % \
                      (self.n_sent, self.n_received, self.n_accepted)
         self.send_conn.close()
         self.recv_conn.close()
 
-
     def on_start(self, event):
         self.timer     = event.reactor.schedule(TIMEOUT, TestTimeout(self))
         self.send_conn = event.container.connect(self.send_addr)
         self.recv_conn = event.container.connect(self.recv_addr)
         self.sender    = event.container.create_sender(self.send_conn, options=DynamicTarget())
 
-
     def send(self):
         while self.sender.credit > 0 and self.n_sent < self.expected:
             self.n_sent += 1
             m = Message(address=self.address, body="Message %d of %d" % (self.n_sent, self.expected))
             self.sender.send(m)
 
-
     def on_link_opened(self, event):
         if event.sender == self.sender:
             # Here we are told the address that we will use for the sender.
             self.address = self.sender.remote_target.address
             self.receiver = event.container.create_receiver(self.recv_conn, self.address)
 
-
     def on_sendable(self, event):
         self.send()
 
-
     def on_message(self, event):
         if event.receiver == self.receiver:
             self.n_received += 1
 
-
     def on_accepted(self, event):
         self.n_accepted += 1
         if self.n_accepted == self.expected:
@@ -1836,16 +1784,12 @@
             self.recv_conn.close()
             self.timer.cancel()
 
-
     def run(self):
         Container(self).run()
 
 
-
-
-
-#=======================================================================
-#=======================================================================
+# =======================================================================
+# =======================================================================
 class DynamicReplyTo(MessagingHandler):
     """
     In this test we have a separate 'client' and 'server' with separate
@@ -1855,6 +1799,7 @@
     the expected number of replies, or with failure if we time out before
     that happens.
     """
+
     def __init__(self, test_name, client_addr, server_addr):
         super(DynamicReplyTo, self).__init__(prefetch=10)
         self.client_addr        = client_addr
@@ -1880,7 +1825,6 @@
         self.num_attempts = 0
         self.addr_check_receiver = None
 
-
     def timeout(self):
         self.error = "Timeout Expired: n_sent=%d received_by_server=%d received_by_client=%d" % \
                      (self.n_sent, self.received_by_server, self.received_by_client)
@@ -1901,8 +1845,8 @@
         self.client_connection.close()
         self.server_connection.close()
 
-    def on_start( self, event):
-        self.timer             = event.reactor.schedule (TIMEOUT, TestTimeout(self))
+    def on_start(self, event):
+        self.timer             = event.reactor.schedule(TIMEOUT, TestTimeout(self))
         # separate connections to simulate client and server.
         self.client_connection = event.container.connect(self.client_addr)
         self.server_connection = event.container.connect(self.server_addr)
@@ -1932,19 +1876,18 @@
                 self.addr_check_timer = event.reactor.schedule(3, AddressCheckerTimeout(self))
 
     def on_sendable(self, event):
-        if self.reply_to_addr == None:
+        if self.reply_to_addr is None:
             return
 
         if event.sender == self.client_sender:
             while event.sender.credit > 0 and self.n_sent < self.n_expected:
                 # We send to server, and tell it how to reply to the client.
-                request = Message ( body=self.n_sent,
-                                    address=self.dest,
-                                    reply_to=self.reply_to_addr )
-                event.sender.send ( request )
+                request = Message(body=self.n_sent,
+                                  address=self.dest,
+                                  reply_to=self.reply_to_addr)
+                event.sender.send(request)
                 self.n_sent += 1
 
-
     def on_message(self, event):
         if event.receiver == self.addr_check_receiver:
             response = self.addr_checker.parse_address_query_response(event.message)
@@ -1963,8 +1906,8 @@
         # Server gets a request and responds to
         # the address that is embedded in the message.
         if event.receiver == self.server_receiver :
-            self.server_sender.send ( Message(address=event.message.reply_to,
-                                      body="Reply hazy, try again later.") )
+            self.server_sender.send(Message(address=event.message.reply_to,
+                                            body="Reply hazy, try again later."))
             self.received_by_server += 1
 
         # Client gets a response and counts it.
@@ -1973,25 +1916,23 @@
             if self.received_by_client == self.n_expected:
                 self.bail()
 
-
     def run(self):
         Container(self).run()
 
 
-
-
-class LinkAttachRoutingCheckOnly ( MessagingHandler ):
+class LinkAttachRoutingCheckOnly (MessagingHandler):
     """
     """
-    def __init__ ( self,
-                   test_name,
-                   container_id,
-                   client_host,
-                   linkroute_container_host,
-                   linkroute_prefix,
-                   addr_suffix
+
+    def __init__(self,
+                 test_name,
+                 container_id,
+                 client_host,
+                 linkroute_container_host,
+                 linkroute_prefix,
+                 addr_suffix
                  ):
-        super ( LinkAttachRoutingCheckOnly, self ).__init__(prefetch=0)
+        super(LinkAttachRoutingCheckOnly, self).__init__(prefetch=0)
         self.client_host               = client_host
         self.linkroute_container_host  = linkroute_container_host
         self.linkroute_prefix          = linkroute_prefix
@@ -2009,23 +1950,19 @@
 
         self.debug = False
 
-
-    def debug_print ( self, message ) :
+    def debug_print(self, message) :
         if self.debug :
             print(message)
 
-
-    def timeout ( self ):
-        self.bail ( "Timeout Expired" )
-
+    def timeout(self):
+        self.bail("Timeout Expired")
 
     def address_check_timeout(self):
-        self.debug_print ( "address_check_timeout -------------" )
+        self.debug_print("address_check_timeout -------------")
         self.linkroute_check()
 
-
-    def bail ( self, text ):
-        self.debug_print ( "bail -------------" )
+    def bail(self, text):
+        self.debug_print("bail -------------")
         self.error = text
         self.linkroute_container_cnx.close()
         self.client_cnx.close()
@@ -2033,9 +1970,8 @@
         if self.linkroute_check_timer:
             self.linkroute_check_timer.cancel()
 
-
     def on_start(self, event):
-        self.debug_print ( "on_start -------------" )
+        self.debug_print("on_start -------------")
         self.timer        = event.reactor.schedule(TIMEOUT, TestTimeout(self))
         self.client_cnx = event.container.connect(self.client_host)
         self.linkroute_container_cnx  = event.container.connect(self.linkroute_container_host)
@@ -2049,39 +1985,36 @@
         self.linkroute_check_receiver = event.container.create_receiver(self.client_cnx, dynamic=True)
         self.linkroute_check_sender   = event.container.create_sender(self.client_cnx, "$management")
 
-
-    def on_link_opened ( self, event ) :
-        self.debug_print ( "on_link_opened -------------" )
+    def on_link_opened(self, event) :
+        self.debug_print("on_link_opened -------------")
         if event.receiver == self.linkroute_check_receiver:
             event.receiver.flow(30)
             # Because we created the linkroute_check_receiver 'dynamic', when it opens
             # it will have its address filled in. That is the address we want our
             # AddressChecker replies to go to.
-            self.linkroute_checker = AddressChecker ( self.linkroute_check_receiver.remote_source.address )
+            self.linkroute_checker = AddressChecker(self.linkroute_check_receiver.remote_source.address)
             self.linkroute_check()
 
-
     def on_message(self, event):
-        self.debug_print ( "on_message -------------" )
+        self.debug_print("on_message -------------")
         if event.receiver == self.linkroute_check_receiver:
             # This is one of my route-readiness checking messages.
             response = self.linkroute_checker.parse_address_query_response(event.message)
-            self.debug_print ( "    status_code: %d   remoteCount: %d   containerCount: %d" % ( response.status_code, response.remoteCount, response.containerCount ) )
+            self.debug_print("    status_code: %d   remoteCount: %d   containerCount: %d" % (response.status_code, response.remoteCount, response.containerCount))
             if response.status_code == 200 and (response.remoteCount + response.containerCount) > 0:
                 # Step 3: got confirmation of link-attach knowledge fully propagated
                 # to Nearside router.  Now we can make the client sender without getting
                 # a No Path To Destination error.
                 self.client_sender = event.container.create_sender(self.client_cnx, self.link_routable_address)
                 # And we can quit checking.
-                self.bail ( None )
+                self.bail(None)
             else:
                 # If the latest check did not find the link-attack route ready,
                 # schedule another check a little while from now.
                 self.linkroute_check_timer = event.reactor.schedule(0.25, AddressCheckerTimeout(self))
 
-
-    def linkroute_check ( self ):
-        self.debug_print ( "linkroute_check -------------" )
+    def linkroute_check(self):
+        self.debug_print("linkroute_check -------------")
         # Send the message that will query the management code to discover
         # information about our destination address. We cannot make our payload
         # sender until the network is ready.
@@ -2089,8 +2022,7 @@
         # BUGALERT: We have to prepend the 'D' to this linkroute prefix
         # because that's what the router does internally.  Someday this
         # may change.
-        self.linkroute_check_sender.send ( self.linkroute_checker.make_address_query("D" + self.linkroute_prefix) )
-
+        self.linkroute_check_sender.send(self.linkroute_checker.make_address_query("D" + self.linkroute_prefix))
 
     def run(self):
         container = Container(self)
@@ -2098,23 +2030,22 @@
         container.run()
 
 
-
-
-class LinkAttachRouting ( MessagingHandler ):
+class LinkAttachRouting (MessagingHandler):
     """
     There are two hosts: near, and far.  The far host is the one that
     the route container will connect to, and it will receive our messages.
     The near host is what our sender will attach to.
     """
-    def __init__ ( self,
-                   test_name,
-                   container_id,
-                   nearside_host,
-                   farside_host,
-                   linkroute_prefix,
-                   addr_suffix
+
+    def __init__(self,
+                 test_name,
+                 container_id,
+                 nearside_host,
+                 farside_host,
+                 linkroute_prefix,
+                 addr_suffix
                  ):
-        super ( LinkAttachRouting, self ).__init__(prefetch=0)
+        super(LinkAttachRouting, self).__init__(prefetch=0)
         self.nearside_host         = nearside_host
         self.farside_host          = farside_host
         self.linkroute_prefix      = linkroute_prefix
@@ -2136,17 +2067,14 @@
         self.test_name    = test_name
         self.container_id = container_id
 
-
-    def timeout ( self ):
-        self.bail ( "Timeout Expired: n_sent=%d n_rcvd=%d n_settled=%d" %
-                    (self.n_sent, self.n_rcvd, self.n_settled) )
-
+    def timeout(self):
+        self.bail("Timeout Expired: n_sent=%d n_rcvd=%d n_settled=%d" %
+                  (self.n_sent, self.n_rcvd, self.n_settled))
 
     def address_check_timeout(self):
         self.linkroute_check()
 
-
-    def bail ( self, text ):
+    def bail(self, text):
         self.error = text
         self.farside_cnx.close()
         self.nearside_cnx.close()
@@ -2154,7 +2082,6 @@
         if self.linkroute_check_timer:
             self.linkroute_check_timer.cancel()
 
-
     def on_start(self, event):
         self.timer        = event.reactor.schedule(TIMEOUT, TestTimeout(self))
         self.nearside_cnx = event.container.connect(self.nearside_host)
@@ -2170,7 +2097,6 @@
         self.linkroute_check_receiver = event.container.create_receiver(self.nearside_cnx, dynamic=True)
         self.linkroute_check_sender   = event.container.create_sender(self.nearside_cnx, "$management")
 
-
     def on_link_opened(self, event):
         if event.receiver:
             event.receiver.flow(self.count)
@@ -2178,7 +2104,6 @@
             self.linkroute_checker = AddressChecker(self.linkroute_check_receiver.remote_source.address)
             self.linkroute_check()
 
-
     def on_message(self, event):
         if event.receiver == self.farside_receiver:
             # This is a payload message.
@@ -2201,8 +2126,7 @@
                 # schedule another check a little while from now.
                 self.linkroute_check_timer = event.reactor.schedule(0.25, AddressCheckerTimeout(self))
 
-
-    def on_link_opening ( self, event ):
+    def on_link_opening(self, event):
         if event.receiver:
             # Step 4.  At start-up, I connected to the route-container listener on
             # Farside, which makes me the route container.  So when a sender attaches
@@ -2216,22 +2140,19 @@
                 self.bail("Incorrect address on incoming receiver: got %s, expected %s" %
                           (event.receiver.remote_target.address, self.link_routable_address))
 
-
-    def on_sendable ( self, event ):
+    def on_sendable(self, event):
         # Step 5: once there is someone on the network who can receive
         # my messages, I get the go-ahead for my sender.
         if event.sender == self.nearside_sender:
             self.send()
 
-
-    def send ( self ):
+    def send(self):
         while self.nearside_sender.credit > 0 and self.n_sent < self.count:
             self.n_sent += 1
             m = Message(body="Message %d of %d" % (self.n_sent, self.count))
             self.nearside_sender.send(m)
 
-
-    def linkroute_check ( self ):
+    def linkroute_check(self):
         # Send the message that will query the management code to discover
         # information about our destination address. We cannot make our payload
         # sender until the network is ready.
@@ -2239,15 +2160,13 @@
         # BUGALERT: We have to prepend the 'D' to this linkroute prefix
         # because that's what the router does internally.  Someday this
         # may change.
-        self.linkroute_check_sender.send ( self.linkroute_checker.make_address_query("D" + self.linkroute_prefix) )
-
+        self.linkroute_check_sender.send(self.linkroute_checker.make_address_query("D" + self.linkroute_prefix))
 
     def on_settled(self, event):
         if event.sender == self.nearside_sender:
             self.n_settled += 1
             if self.n_settled == self.count:
-                self.bail ( None )
-
+                self.bail(None)
 
     def run(self):
         container = Container(self)
@@ -2255,10 +2174,7 @@
         container.run()
 
 
-
-
-
-class ClosestTest ( MessagingHandler ):
+class ClosestTest (MessagingHandler):
     """
     Test whether distance-based message routing works in a
     3-router network. The network may be linear or mesh,
@@ -2276,9 +2192,10 @@
     router_1, and then 2 receivers each on all 3 routers.
 
     """
-    def __init__ ( self, test_name, router_1, router_2, router_3, addr_suffix,
-                   print_debug=False ):
-        super ( ClosestTest, self ).__init__(prefetch=0)
+
+    def __init__(self, test_name, router_1, router_2, router_3, addr_suffix,
+                 print_debug=False):
+        super(ClosestTest, self).__init__(prefetch=0)
         self.error       = None
         self.router_1    = router_1
         self.router_2    = router_2
@@ -2322,16 +2239,14 @@
 
         self.print_debug = print_debug
 
-    def timeout ( self ):
+    def timeout(self):
         sys.stdout.flush()
-        self.bail ( "Timeout Expired " )
-
+        self.bail("Timeout Expired ")
 
     def address_check_timeout(self):
         self.addr_check()
 
-
-    def bail ( self, text ):
+    def bail(self, text):
         self.timer.cancel()
         self.error = text
         self.send_cnx.close()
@@ -2341,52 +2256,50 @@
         if self.addr_check_timer:
             self.addr_check_timer.cancel()
 
-
-    def on_start ( self, event ):
-        self.timer    = event.reactor.schedule  ( TIMEOUT, TestTimeout(self) )
-        self.send_cnx = event.container.connect ( self.router_1 )
-        self.cnx_1    = event.container.connect ( self.router_1 )
-        self.cnx_2    = event.container.connect ( self.router_2 )
-        self.cnx_3    = event.container.connect ( self.router_3 )
+    def on_start(self, event):
+        self.timer    = event.reactor.schedule(TIMEOUT, TestTimeout(self))
+        self.send_cnx = event.container.connect(self.router_1)
+        self.cnx_1    = event.container.connect(self.router_1)
+        self.cnx_2    = event.container.connect(self.router_2)
+        self.cnx_3    = event.container.connect(self.router_3)
 
         # Warning!
         # The two receiver-links on each router must be given
         # explicit distinct names, or we will in fact only get
         # one link.  And then wonder why receiver 2 on each
         # router isn't getting any messages.
-        self.recv_1_a  = event.container.create_receiver  ( self.cnx_1, self.dest, name=link_name() )
-        self.recv_1_b  = event.container.create_receiver  ( self.cnx_1, self.dest, name=link_name() )
+        self.recv_1_a  = event.container.create_receiver(self.cnx_1, self.dest, name=link_name())
+        self.recv_1_b  = event.container.create_receiver(self.cnx_1, self.dest, name=link_name())
 
-        self.recv_2_a  = event.container.create_receiver  ( self.cnx_2,  self.dest, name=link_name() )
-        self.recv_2_b  = event.container.create_receiver  ( self.cnx_2,  self.dest, name=link_name() )
+        self.recv_2_a  = event.container.create_receiver(self.cnx_2,  self.dest, name=link_name())
+        self.recv_2_b  = event.container.create_receiver(self.cnx_2,  self.dest, name=link_name())
 
-        self.recv_3_a  = event.container.create_receiver  ( self.cnx_3,  self.dest, name=link_name() )
-        self.recv_3_b  = event.container.create_receiver  ( self.cnx_3,  self.dest, name=link_name() )
+        self.recv_3_a  = event.container.create_receiver(self.cnx_3,  self.dest, name=link_name())
+        self.recv_3_b  = event.container.create_receiver(self.cnx_3,  self.dest, name=link_name())
 
-        self.recv_1_a.flow ( self.n_expected )
-        self.recv_2_a.flow ( self.n_expected )
-        self.recv_3_a.flow ( self.n_expected )
+        self.recv_1_a.flow(self.n_expected)
+        self.recv_2_a.flow(self.n_expected)
+        self.recv_3_a.flow(self.n_expected)
 
-        self.recv_1_b.flow ( self.n_expected )
-        self.recv_2_b.flow ( self.n_expected )
-        self.recv_3_b.flow ( self.n_expected )
+        self.recv_1_b.flow(self.n_expected)
+        self.recv_2_b.flow(self.n_expected)
+        self.recv_3_b.flow(self.n_expected)
 
-        self.addr_check_receiver = event.container.create_receiver ( self.cnx_1, dynamic=True )
+        self.addr_check_receiver = event.container.create_receiver(self.cnx_1, dynamic=True)
         self.addr_check_receiver.flow(100)
-        self.addr_check_sender   = event.container.create_sender ( self.cnx_1, "$management" )
+        self.addr_check_sender   = event.container.create_sender(self.cnx_1, "$management")
 
         self.m_sent_1 = False
         self.m_sent_2 = False
         self.m_sent_3 = False
 
-
     def on_link_opened(self, event):
         if event.receiver == self.addr_check_receiver:
             # my addr-check link has opened: make the addr_checker with the given address.
-            self.addr_checker = AddressChecker ( self.addr_check_receiver.remote_source.address )
+            self.addr_checker = AddressChecker(self.addr_check_receiver.remote_source.address)
             self.addr_check()
 
-    def on_message ( self, event ):
+    def on_message(self, event):
         if event.receiver == self.addr_check_receiver:
             # This is a response to one of my address-readiness checking messages.
             response = self.addr_checker.parse_address_query_response(event.message)
@@ -2396,7 +2309,7 @@
                     # routers that know about the address. The network is ready.
                     # Now we can make the sender without getting a
                     # "No Path To Destination" error.
-                    self.sender = event.container.create_sender ( self.send_cnx, self.dest )
+                    self.sender = event.container.create_sender(self.send_cnx, self.dest)
 
                     if not self.m_sent_1:
                         self.m_sent_1 = True
@@ -2406,7 +2319,7 @@
                             self.sender.send(msg)
                             self.n_sent_1 += 1
                         if self.print_debug:
-                            print ("First hundred sent")
+                            print("First hundred sent")
 
                     # And we can quit checking.
                     if self.addr_check_timer:
@@ -2455,7 +2368,7 @@
             elif event.receiver == self.recv_3_a:
                 self.count_3_a += 1
                 if self.print_debug:
-                    print ("self.count_3_a", self.count_3_a)
+                    print("self.count_3_a", self.count_3_a)
             elif event.receiver == self.recv_3_b:
                 self.count_3_b += 1
                 if self.print_debug:
@@ -2470,10 +2383,10 @@
                 self.recv_1_a.close()
                 self.recv_1_b.close()
                 if (self.count_2_a + self.count_2_b + self.count_3_a + self.count_3_b) > 0 :
-                    self.bail ( "error: routers 2 or 3 got messages before router 1 receivers were closed." )
+                    self.bail("error: routers 2 or 3 got messages before router 1 receivers were closed.")
                 # Make sure both receivers got some messages.
-                if (self.count_1_a < self.one_third/2 or  self.count_1_b < self.one_third/2) or (self.count_1_b != self.count_1_a):
-                    self.bail ( "error: recv_1_a and  recv_1_b did not get equal number of messages" )
+                if (self.count_1_a < self.one_third / 2 or self.count_1_b < self.one_third / 2) or (self.count_1_b != self.count_1_a):
+                    self.bail("error: recv_1_a and  recv_1_b did not get equal number of messages")
 
             elif self.n_received == 2 * self.one_third:
                 if self.print_debug:
@@ -2484,10 +2397,10 @@
                 self.recv_2_a.close()
                 self.recv_2_b.close()
                 if (self.count_3_a + self.count_3_b) > 0 :
-                    self.bail ( "error: router 3 got messages before 2 was closed." )
+                    self.bail("error: router 3 got messages before 2 was closed.")
                 # Make sure both receivers got some messages.
-                if (self.count_2_a < self.one_third/2 or  self.count_2_b < self.one_third/2) or (self.count_2_b != self.count_2_a):
-                    self.bail ( "error: recv_2_a and  recv_2_b did not get equal number of messages" )
+                if (self.count_2_a < self.one_third / 2 or self.count_2_b < self.one_third / 2) or (self.count_2_b != self.count_2_a):
+                    self.bail("error: recv_2_a and  recv_2_b did not get equal number of messages")
 
             # By the time we reach the expected number of messages
             # we have closed the router_1 and router_2 receivers.  If the
@@ -2495,10 +2408,10 @@
             if self.n_received >= self.n_expected :
                 if self.print_debug:
                     print("Third one third received")
-                if (self.count_3_a < self.one_third/2 or  self.count_3_b < self.one_third/2) or (self.count_3_b != self.count_3_a):
-                    self.bail ( "error: recv_3_a and  recv_3_b did not get equal number of messages" )
+                if (self.count_3_a < self.one_third / 2 or self.count_3_b < self.one_third / 2) or (self.count_3_b != self.count_3_a):
+                    self.bail("error: recv_3_a and  recv_3_b did not get equal number of messages")
                 else:
-                    self.bail ( None )
+                    self.bail(None)
 
     def on_link_closed(self, event):
         if event.receiver == self.recv_1_b or event.receiver == self.recv_1_a:
@@ -2508,7 +2421,7 @@
                 self.recv_1_b_closed = True
             if self.recv_1_a_closed and self.recv_1_b_closed and not self.m_sent_2:
                 if self.print_debug:
-                    print ("self.recv_1_a_closed and self.recv_1_b_closed")
+                    print("self.recv_1_a_closed and self.recv_1_b_closed")
 
                 self.m_sent_2 = True
                 while self.n_sent_3 < self.one_third:
@@ -2527,10 +2440,10 @@
             if self.recv_2_a_closed and self.recv_2_b_closed:
                 self.first_check = False
                 if self.print_debug:
-                    print ("self.recv_2_a_closed and self.recv_2_b_closed")
+                    print("self.recv_2_a_closed and self.recv_2_b_closed")
                 self.addr_check()
 
-    def addr_check ( self ):
+    def addr_check(self):
         # Send the message that will query the management code to discover
         # information about our destination address. We cannot make our payload
         # sender until the network is ready.
@@ -2538,18 +2451,14 @@
         # BUGALERT: We have to prepend the 'M0' to this address prefix
         # because that's what the router does internally.  Someday this
         # may change.
-        self.addr_check_sender.send ( self.addr_checker.make_address_query("M0" + self.dest) )
-
+        self.addr_check_sender.send(self.addr_checker.make_address_query("M0" + self.dest))
 
     def run(self):
         container = Container(self)
         container.run()
 
 
-
-
-
-class BalancedTest ( MessagingHandler ):
+class BalancedTest (MessagingHandler):
     """
     This test is topology-agnostic. This code thinks of its nodes as 1, 2, 3.
     The caller knows if they are linear or triangular, or a tree.  It calculates
@@ -2558,20 +2467,21 @@
     ( Slop can happen in some topologies when you can't tell whether spillover
     will happen first to node 2, or to node 3.
     """
-    def __init__ ( self,
-                   test_name,
-                   router_1,
-                   router_2,
-                   router_3,
-                   addr_suffix,
-                   total_messages,
-                   expected_1,
-                   expected_2,
-                   expected_3,
-                   slop,
-                   omit_middle_receiver
-                ):
-        super ( BalancedTest, self ).__init__(prefetch=0, auto_accept=False)
+
+    def __init__(self,
+                 test_name,
+                 router_1,
+                 router_2,
+                 router_3,
+                 addr_suffix,
+                 total_messages,
+                 expected_1,
+                 expected_2,
+                 expected_3,
+                 slop,
+                 omit_middle_receiver
+                 ):
+        super(BalancedTest, self).__init__(prefetch=0, auto_accept=False)
         self.error       = None
         self.router_3    = router_3
         self.router_2    = router_2
@@ -2604,16 +2514,13 @@
         self.payload_sender = None
         self.test_name      = test_name
 
-
-    def timeout ( self ):
-        self.bail ( "Timeout Expired " )
-
+    def timeout(self):
+        self.bail("Timeout Expired ")
 
     def address_check_timeout(self):
         self.address_check()
 
-
-    def bail ( self, text ):
+    def bail(self, text):
         self.timer.cancel()
         self.error = text
         self.cnx_3.close()
@@ -2622,37 +2529,34 @@
         if self.address_check_timer:
             self.address_check_timer.cancel()
 
+    def on_start(self, event):
+        self.timer    = event.reactor.schedule(TIMEOUT, TestTimeout(self))
+        self.cnx_3    = event.container.connect(self.router_3)
+        self.cnx_2    = event.container.connect(self.router_2)
+        self.cnx_1    = event.container.connect(self.router_1)
 
-    def on_start ( self, event ):
-        self.timer    = event.reactor.schedule  ( TIMEOUT, TestTimeout(self) )
-        self.cnx_3    = event.container.connect ( self.router_3 )
-        self.cnx_2    = event.container.connect ( self.router_2 )
-        self.cnx_1    = event.container.connect ( self.router_1 )
-
-        self.recv_3  = event.container.create_receiver ( self.cnx_3,  self.dest )
+        self.recv_3  = event.container.create_receiver(self.cnx_3,  self.dest)
         if self.omit_middle_receiver is False :
-            self.recv_2 = event.container.create_receiver ( self.cnx_2,  self.dest )
-        self.recv_1  = event.container.create_receiver ( self.cnx_1,  self.dest )
+            self.recv_2 = event.container.create_receiver(self.cnx_2,  self.dest)
+        self.recv_1  = event.container.create_receiver(self.cnx_1,  self.dest)
 
-        self.recv_3.flow ( self.total_messages )
+        self.recv_3.flow(self.total_messages)
         if self.omit_middle_receiver is False :
-            self.recv_2.flow ( self.total_messages )
-        self.recv_1.flow ( self.total_messages )
+            self.recv_2.flow(self.total_messages)
+        self.recv_1.flow(self.total_messages)
 
-        self.address_check_receiver = event.container.create_receiver ( self.cnx_1, dynamic=True )
-        self.address_check_sender   = event.container.create_sender   ( self.cnx_1, "$management" )
-
+        self.address_check_receiver = event.container.create_receiver(self.cnx_1, dynamic=True)
+        self.address_check_sender   = event.container.create_sender(self.cnx_1, "$management")
 
     def on_link_opened(self, event):
         if event.receiver:
-            event.receiver.flow ( self.total_messages )
+            event.receiver.flow(self.total_messages)
         if event.receiver == self.address_check_receiver:
             # My address check-link has opened: make the address_checker
-            self.address_checker = AddressChecker ( self.address_check_receiver.remote_source.address )
+            self.address_checker = AddressChecker(self.address_check_receiver.remote_source.address)
             self.address_check()
 
-
-    def on_message ( self, event ):
+    def on_message(self, event):
 
         if self.n_received >= self.total_messages:
             return   # Sometimes you can get a message or two even after you have called bail().
@@ -2670,7 +2574,7 @@
                 # Since I have 3 nodes, I want to see 1 subscriber (which is on the local router) and
                 # 2 remote routers that know about my destination address.
                 # Now we can safely make the payload sender without getting a 'No Path To Destination' error.
-                self.payload_sender = event.container.create_sender ( self.cnx_1, self.dest )
+                self.payload_sender = event.container.create_sender(self.cnx_1, self.dest)
                 # And we can quit checking.
                 if self.address_check_timer:
                     self.address_check_timer.cancel()
@@ -2683,9 +2587,12 @@
         else:
             self.n_received += 1
 
-            if   event.receiver == self.recv_1: self.count_1 += 1
-            elif event.receiver == self.recv_2: self.count_2 += 1
-            elif event.receiver == self.recv_3: self.count_3 += 1
+            if event.receiver == self.recv_1:
+                self.count_1 += 1
+            elif event.receiver == self.recv_2:
+                self.count_2 += 1
+            elif event.receiver == self.recv_3:
+                self.count_3 += 1
 
             # I do not check for count_1 + count_2 + count_3 == total,
             # because it always will be due to how the code counts things.
@@ -2693,21 +2600,19 @@
                 if abs(self.count_1 - self.expected_1) > self.slop or \
                    abs(self.count_2 - self.expected_2) > self.slop or \
                    abs(self.count_3 - self.expected_3) > self.slop  :
-                    self.bail ( "expected: ( %d, %d, %d )  got: ( %d, %d, %d )" % (self.expected_1, self.expected_2, self.expected_3, self.count_1, self.count_2, self.count_3) )
+                    self.bail("expected: ( %d, %d, %d )  got: ( %d, %d, %d )" % (self.expected_1, self.expected_2, self.expected_3, self.count_1, self.count_2, self.count_3))
                 else:
-                    self.bail ( None ) # All is well.
+                    self.bail(None)  # All is well.
 
-
-    def on_sendable ( self, event ):
+    def on_sendable(self, event):
         if self.n_sent < self.total_messages and event.sender == self.payload_sender :
-            msg = Message ( body     = "Hello, balanced.",
-                            address  = self.dest
+            msg = Message(body="Hello, balanced.",
+                          address=self.dest
                           )
-            self.payload_sender.send ( msg )
+            self.payload_sender.send(msg)
             self.n_sent += 1
 
-
-    def address_check ( self ):
+    def address_check(self):
         # Send the message that will query the management code to discover
         # information about our destination address. We cannot make our payload
         # sender until the network is ready.
@@ -2715,30 +2620,27 @@
         # BUGALERT: We have to prepend the 'M0' to this address prefix
         # because that's what the router does internally.  Someday this
         # may change.
-        self.address_check_sender.send ( self.address_checker.make_address_query("M0" + self.dest) )
-
+        self.address_check_sender.send(self.address_checker.make_address_query("M0" + self.dest))
 
     def run(self):
         container = Container(self)
         container.run()
 
 
-
-
-
-class MulticastTest ( MessagingHandler ):
+class MulticastTest (MessagingHandler):
     """
     Using multicast, we should see all receivers get everything,
     whether the topology is linear or mesh.
     """
-    def __init__ ( self,
-                   test_name,
-                   router_1,
-                   router_2,
-                   router_3,
-                   addr_suffix
+
+    def __init__(self,
+                 test_name,
+                 router_1,
+                 router_2,
+                 router_3,
+                 addr_suffix
                  ):
-        super ( MulticastTest, self ).__init__(prefetch=0)
+        super(MulticastTest, self).__init__(prefetch=0)
         self.error       = None
         self.router_1    = router_1
         self.router_2    = router_2
@@ -2765,15 +2667,13 @@
         self.bailed              = False
         self.test_name           = test_name
 
-    def timeout ( self ):
-        self.bail ( "Timeout Expired " )
-
+    def timeout(self):
+        self.bail("Timeout Expired ")
 
     def address_check_timeout(self):
         self.addr_check()
 
-
-    def bail ( self, text ):
+    def bail(self, text):
         self.timer.cancel()
         self.error = text
         self.send_cnx.close()
@@ -2783,62 +2683,58 @@
         if self.addr_check_timer:
             self.addr_check_timer.cancel()
 
-
-    def on_start ( self, event ):
-        self.timer    = event.reactor.schedule  ( TIMEOUT, TestTimeout(self) )
-        self.send_cnx = event.container.connect ( self.router_1 )
-        self.cnx_1    = event.container.connect ( self.router_1 )
-        self.cnx_2    = event.container.connect ( self.router_2 )
-        self.cnx_3    = event.container.connect ( self.router_3 )
+    def on_start(self, event):
+        self.timer    = event.reactor.schedule(TIMEOUT, TestTimeout(self))
+        self.send_cnx = event.container.connect(self.router_1)
+        self.cnx_1    = event.container.connect(self.router_1)
+        self.cnx_2    = event.container.connect(self.router_2)
+        self.cnx_3    = event.container.connect(self.router_3)
 
         # Warning!
         # The two receiver-links on each router must be given
         # explicit distinct names, or we will in fact only get
         # one link.  And then wonder why receiver 2 on each
         # router isn't getting any messages.
-        self.recv_1_a  = event.container.create_receiver  ( self.cnx_1, self.dest, name=link_name() )
-        self.recv_1_b  = event.container.create_receiver  ( self.cnx_1, self.dest, name=link_name() )
+        self.recv_1_a  = event.container.create_receiver(self.cnx_1, self.dest, name=link_name())
+        self.recv_1_b  = event.container.create_receiver(self.cnx_1, self.dest, name=link_name())
 
-        self.recv_2_a  = event.container.create_receiver  ( self.cnx_2,  self.dest, name=link_name() )
-        self.recv_2_b  = event.container.create_receiver  ( self.cnx_2,  self.dest, name=link_name() )
+        self.recv_2_a  = event.container.create_receiver(self.cnx_2,  self.dest, name=link_name())
+        self.recv_2_b  = event.container.create_receiver(self.cnx_2,  self.dest, name=link_name())
 
-        self.recv_3_a  = event.container.create_receiver  ( self.cnx_3,  self.dest, name=link_name() )
-        self.recv_3_b  = event.container.create_receiver  ( self.cnx_3,  self.dest, name=link_name() )
+        self.recv_3_a  = event.container.create_receiver(self.cnx_3,  self.dest, name=link_name())
+        self.recv_3_b  = event.container.create_receiver(self.cnx_3,  self.dest, name=link_name())
 
-        self.recv_1_a.flow ( self.n_to_send )
-        self.recv_2_a.flow ( self.n_to_send )
-        self.recv_3_a.flow ( self.n_to_send )
+        self.recv_1_a.flow(self.n_to_send)
+        self.recv_2_a.flow(self.n_to_send)
+        self.recv_3_a.flow(self.n_to_send)
 
-        self.recv_1_b.flow ( self.n_to_send )
-        self.recv_2_b.flow ( self.n_to_send )
-        self.recv_3_b.flow ( self.n_to_send )
+        self.recv_1_b.flow(self.n_to_send)
+        self.recv_2_b.flow(self.n_to_send)
+        self.recv_3_b.flow(self.n_to_send)
 
-        self.addr_check_receiver = event.container.create_receiver ( self.cnx_1, dynamic=True )
-        self.addr_check_sender   = event.container.create_sender ( self.cnx_1, "$management" )
-
+        self.addr_check_receiver = event.container.create_receiver(self.cnx_1, dynamic=True)
+        self.addr_check_sender   = event.container.create_sender(self.cnx_1, "$management")
 
     def on_link_opened(self, event):
         if event.receiver:
-            event.receiver.flow ( self.n_to_send )
+            event.receiver.flow(self.n_to_send)
         if event.receiver == self.addr_check_receiver:
             # my addr-check link has opened: make the addr_checker with the given address.
-            self.addr_checker = AddressChecker ( self.addr_check_receiver.remote_source.address )
+            self.addr_checker = AddressChecker(self.addr_check_receiver.remote_source.address)
             self.addr_check()
 
-
-    def on_sendable ( self, event ):
+    def on_sendable(self, event):
         if self.sender and self.n_sent < self.n_to_send :
-            msg = Message ( body     = "Hello, closest.",
-                            address  = self.dest
+            msg = Message(body="Hello, closest.",
+                          address=self.dest
                           )
-            dlv = self.sender.send ( msg )
+            dlv = self.sender.send(msg)
             self.n_sent += 1
             dlv.settle()
 
+    def on_message(self, event):
 
-    def on_message ( self, event ):
-
-        #if self.bailed is True :
+        # if self.bailed is True :
         #    return
 
         if event.receiver == self.addr_check_receiver:
@@ -2849,7 +2745,7 @@
                 # routers that know about the address. The network is ready.
                 # Now we can make the sender without getting a
                 # "No Path To Destination" error.
-                self.sender = event.container.create_sender ( self.send_cnx, self.dest )
+                self.sender = event.container.create_sender(self.send_cnx, self.dest)
 
                 # And we can quit checking.
                 if self.addr_check_timer:
@@ -2865,7 +2761,7 @@
 
             # Count the messages that have come in for
             # each receiver.
-            if   event.receiver == self.recv_1_a:
+            if event.receiver == self.recv_1_a:
                 self.count_1_a += 1
             elif event.receiver == self.recv_1_b:
                 self.count_1_b += 1
@@ -2883,15 +2779,13 @@
                 # Our reception count should be 6x our send-count,
                 # and all receiver-counts should be equal.
                 if self.count_1_a == self.count_1_b and self.count_1_b == self.count_2_a and self.count_2_a == self.count_2_b and self.count_2_b == self.count_3_a and self.count_3_a == self.count_3_b :
-                    self.bail ( None )
+                    self.bail(None)
                     self.bailed = True
                 else:
-                    self.bail ( "receivers not equal: %d %d %d %d %d %d" % (self.count_1_a, self.count_1_b, self.count_2_a, self.count_2_b, self.count_3_a, self.count_3_b) )
+                    self.bail("receivers not equal: %d %d %d %d %d %d" % (self.count_1_a, self.count_1_b, self.count_2_a, self.count_2_b, self.count_3_a, self.count_3_b))
                     self.bailed = True
 
-
-
-    def addr_check ( self ):
+    def addr_check(self):
         # Send the message that will query the management code to discover
         # information about our destination address. We cannot make our payload
         # sender until the network is ready.
@@ -2899,17 +2793,14 @@
         # BUGALERT: We have to prepend the 'M0' to this address prefix
         # because that's what the router does internally.  Someday this
         # may change.
-        self.addr_check_sender.send ( self.addr_checker.make_address_query("M0" + self.dest) )
-
+        self.addr_check_sender.send(self.addr_checker.make_address_query("M0" + self.dest))
 
     def run(self):
         container = Container(self)
         container.run()
 
 
-
-
-class RoutingTest ( MessagingHandler ):
+class RoutingTest (MessagingHandler):
     """
     Accept a network of three routers -- either linear or triangular,
     depending on what the caller chooses -- make some senders, and see
@@ -2931,19 +2822,19 @@
     #      up to the point where it becomes dependent on the instruction
     #      list that is passed in from the caller.
 
-    def __init__ ( self,
-                   test_name,
-                   container_id,
-                   sender_host,
-                   route_container_addrs,
-                   linkroute_prefix,
-                   addr_suffix,
-                   instructions,
-                   where_to_make_connections,
-                   n_local_containers,
-                   n_remote_routers
+    def __init__(self,
+                 test_name,
+                 container_id,
+                 sender_host,
+                 route_container_addrs,
+                 linkroute_prefix,
+                 addr_suffix,
+                 instructions,
+                 where_to_make_connections,
+                 n_local_containers,
+                 n_remote_routers
                  ):
-        super ( RoutingTest, self ).__init__(prefetch=0)
+        super(RoutingTest, self).__init__(prefetch=0)
 
         self.debug     = False
         self.test_name = test_name
@@ -2992,7 +2883,7 @@
         # Each dict will hold one of these:
         #    < cnx : receiver_count >
         # for each cnx on that router.
-        self.router_cnx_counts = [ dict(), dict(), dict() ]
+        self.router_cnx_counts = [dict(), dict(), dict()]
         self.cnx_status        = dict()
         self.waiting_for_address_to_go_away = False
         self.sent_address_ready = False
@@ -3000,25 +2891,22 @@
         self.status = 'start up'
         self.container_id = container_id
 
-
-    def debug_print ( self, message ) :
+    def debug_print(self, message) :
         if self.debug :
             print(message)
 
-
     # If this happens, the test is hanging.
-    def timeout ( self ):
-        self.start_shutting_down ( "Timeout Expired while: %s" % self.status )
-
+    def timeout(self):
+        self.start_shutting_down("Timeout Expired while: %s" % self.status)
 
     # This helps us periodically send management queries
     # to learn when our address os ready to be used on the
     # router network.
+
     def address_check_timeout(self):
         self.linkroute_check()
 
-
-    #=================================================================
+    # =================================================================
     # The address-checker is always running.
     # When this function gets us into the mode of starting
     # to shut down, then we look for the linkroutable address
@@ -3028,15 +2916,14 @@
     # with later tests (if one is run immediately after).
     # The next test will often (like, 20% of the time) get spurious
     # no route to destination errors.
-    #=================================================================
-    def start_shutting_down ( self, text ):
+    # =================================================================
+    def start_shutting_down(self, text):
         self.done = True
         self.error = text
         self.close_route_container_connections()
         self.waiting_for_address_to_go_away = True
 
-
-    def finish ( self ):
+    def finish(self):
         self.done = True
         self.sender_cnx.close()
         self.timer.cancel()
@@ -3044,11 +2931,10 @@
             self.linkroute_check_timer.cancel()
         self.event_injector.close()
 
-
-    def on_start ( self, event ):
-        self.debug_print ( "\n\n%s ===========================================\n\n" % self.test_name )
-        self.debug_print ( "on_start -------------" )
-        self.timer = event.reactor.schedule ( TIMEOUT, TestTimeout(self) )
+    def on_start(self, event):
+        self.debug_print("\n\n%s ===========================================\n\n" % self.test_name)
+        self.debug_print("on_start -------------")
+        self.timer = event.reactor.schedule(TIMEOUT, TestTimeout(self))
         event.reactor.selectable(self.event_injector)
         self.sender_cnx = event.container.connect(self.sender_host)
 
@@ -3068,12 +2954,12 @@
             how_many_for_this_router = self.where_to_make_connections[router]
             for j in range(how_many_for_this_router) :
                 route_container_addr = self.route_container_addrs[router]
-                cnx = event.container.connect ( route_container_addr )
+                cnx = event.container.connect(route_container_addr)
                 # In the dict of connections and actual receiver
                 # counts, store this cnx, and 0.
                 self.router_cnx_counts[router][cnx] = 0
                 self.cnx_status[cnx] = 1
-                self.debug_print ( "on_start: made cnx %s on router %d" % ( str(cnx), router ) )
+                self.debug_print("on_start: made cnx %s on router %d" % (str(cnx), router))
 
         # STEP 2 : Make a sender and receiver that we will use to tell when the router
         #          network is ready to handle our reoutable address. This sender will
@@ -3083,39 +2969,37 @@
         #          dynamic.  That means that when we receive the on_link_opened event for
         #          it, we will be handed its address -- which we will then use as the reply-to
         #          address for the management queries we send.
-        self.linkroute_check_receiver = event.container.create_receiver ( self.sender_cnx, dynamic=True )
-        self.linkroute_check_sender   = event.container.create_sender   ( self.sender_cnx, "$management" )
+        self.linkroute_check_receiver = event.container.create_receiver(self.sender_cnx, dynamic=True)
+        self.linkroute_check_sender   = event.container.create_sender(self.sender_cnx, "$management")
 
-
-    #=================================================
+    # =================================================
     # custom event
     # The link-attach-routable address is ready
     # for use in the router network.
-    #=================================================
-    def on_address_ready ( self, event ):
+    # =================================================
+    def on_address_ready(self, event):
         # STEP 5 : Our link-attach routable address now has the expected
         #          number of local and remote receivers. Open for business!
         #          Time to start making sender-links to this address, and
         #          see where their link-attaches get routed to.
-        self.debug_print ( "on_address_ready -------------" )
-        current_step = self.instructions [ self.current_step_index ]
+        self.debug_print("on_address_ready -------------")
+        current_step = self.instructions[self.current_step_index]
         if current_step['event'] != 'address_ready' :
-            self.start_shutting_down ( "out-of-sequence event: address_ready while expecting %s" % current_step['event'] )
+            self.start_shutting_down("out-of-sequence event: address_ready while expecting %s" % current_step['event'])
         else :
             action = current_step['action']
             if action['fn'] == 'make_senders' :
                 self.status = 'making senders'
                 arg = int(action['arg'])
-                self.make_senders ( arg )
+                self.make_senders(arg)
                 self.expected_receivers = arg
                 self.receiver_count = 0
                 self.current_step_index += 1
-                self.debug_print ( "current step advance to %d" % self.current_step_index )
+                self.debug_print("current step advance to %d" % self.current_step_index)
             else :
-                self.start_shutting_down ( "on_address_ready: unexpected action fn %s" % action['fn'] )
+                self.start_shutting_down("on_address_ready: unexpected action fn %s" % action['fn'])
 
-
-    #=======================================================
+    # =======================================================
     # custom event
     # STEP 7 : The correct number of receiver-links,
     #          corresponding to the number of senders that
@@ -3125,90 +3009,87 @@
     #                after this the behavior of the test
     #                changes based on the instruction list
     #                that it received from the caller.
-    #=======================================================
-    def on_got_receivers ( self, event ):
+    # =======================================================
+    def on_got_receivers(self, event):
 
         if self.done :
             return
 
-        self.debug_print ( "on_got_receivers -------------" )
-        current_step = self.instructions [ self.current_step_index ]
+        self.debug_print("on_got_receivers -------------")
+        current_step = self.instructions[self.current_step_index]
 
         if current_step['event'] != 'got_receivers' :
-            self.start_shutting_down ( "out-of-sequence event: got_receivers while expecting %s" % current_step['event'] )
+            self.start_shutting_down("out-of-sequence event: got_receivers while expecting %s" % current_step['event'])
         else :
-          action = current_step['action']
-          if action['fn'] != 'check_receiver_distribution' :
-              self.start_shutting_down ( "on_got_receivers: unexpected action fn %s" % action['fn'] )
-          else :
-              self.status = "checking receiver distribution"
-              error = self.check_receiver_distribution ( action['arg'] )
-              if error :
-                  self.debug_print ( "check_receiver_distribution error" )
-                  self.start_shutting_down ( error )
-              else:
-                  self.debug_print ( "receiver_distribution_ok" )
-                  self.event_injector.trigger ( self.receiver_distribution_ok_event )
-                  self.current_step_index += 1
-                  self.debug_print ( "current step advance to %d" % self.current_step_index )
+            action = current_step['action']
+            if action['fn'] != 'check_receiver_distribution' :
+                self.start_shutting_down("on_got_receivers: unexpected action fn %s" % action['fn'])
+            else :
+                self.status = "checking receiver distribution"
+                error = self.check_receiver_distribution(action['arg'])
+                if error :
+                    self.debug_print("check_receiver_distribution error")
+                    self.start_shutting_down(error)
+                else:
+                    self.debug_print("receiver_distribution_ok")
+                    self.event_injector.trigger(self.receiver_distribution_ok_event)
+                    self.current_step_index += 1
+                    self.debug_print("current step advance to %d" % self.current_step_index)
 
-
-
-    #=======================================================
+    # =======================================================
     # custom event
     # The receiver links that we got after creating some
     # senders went to the right place.
-    #=======================================================
-    def on_receiver_distribution_ok ( self, event ) :
-        self.debug_print ( "on_receiver_distribution_ok ------------" )
-        current_step = self.instructions [ self.current_step_index ]
+    # =======================================================
+
+    def on_receiver_distribution_ok(self, event) :
+        self.debug_print("on_receiver_distribution_ok ------------")
+        current_step = self.instructions[self.current_step_index]
 
         if current_step['event'] != 'receiver_distribution_ok' :
-            self.start_shutting_down ( "out-of-sequence event: receiver_distribution_ok while expecting %s" % current_step['event'] )
+            self.start_shutting_down("out-of-sequence event: receiver_distribution_ok while expecting %s" % current_step['event'])
         else :
             action = current_step['action']
             if action['fn'] == 'none' :
-                self.debug_print ( "on_receiver_distribution_ok: test succeeding." )
-                self.start_shutting_down ( None )
+                self.debug_print("on_receiver_distribution_ok: test succeeding.")
+                self.start_shutting_down(None)
             elif action['fn'] == 'kill_connections' :
                 router = int(action['arg'])
                 self.connections_to_be_closed = 2
                 self.connections_closed = 0
-                self.debug_print ( "on_receiver_distribution_ok: killing %d connections on router %d" % (self.connections_to_be_closed, router ) )
-                self.close_route_container_connections_on_router_n ( router )
+                self.debug_print("on_receiver_distribution_ok: killing %d connections on router %d" % (self.connections_to_be_closed, router))
+                self.close_route_container_connections_on_router_n(router)
                 self.current_step_index += 1
-                self.debug_print ( "current step advance to %d" % self.current_step_index )
+                self.debug_print("current step advance to %d" % self.current_step_index)
             else :
-                self.start_shutting_down ( "on_receiver_distribution_ok: unexpected action fn %s" % action['fn'] )
+                self.start_shutting_down("on_receiver_distribution_ok: unexpected action fn %s" % action['fn'])
 
-
-    #=======================================================
+    # =======================================================
     # custom event
     # We were told to close the connections on a router
     # and now all those connections have been closed.
-    #=======================================================
-    def on_connections_closed ( self, event ) :
-        self.debug_print ( "on_connections_closed ------------" )
-        current_step = self.instructions [ self.current_step_index ]
+    # =======================================================
+    def on_connections_closed(self, event) :
+        self.debug_print("on_connections_closed ------------")
+        current_step = self.instructions[self.current_step_index]
 
         if current_step['event'] != 'connections_closed' :
-            self.start_shutting_down ( "out-of-sequence event: connections_closed while expecting %s" % current_step['event'] )
+            self.start_shutting_down("out-of-sequence event: connections_closed while expecting %s" % current_step['event'])
         else :
             action = current_step['action']
             if action['fn'] == 'make_senders' :
                 self.status = 'making senders'
                 arg = int(action['arg'])
-                self.make_senders ( arg )
+                self.make_senders(arg)
                 self.expected_receivers = arg
                 self.receiver_count = 0
-                self.debug_print ( "now expecting %d new receivers." % self.expected_receivers )
+                self.debug_print("now expecting %d new receivers." % self.expected_receivers)
                 self.current_step_index += 1
-                self.debug_print ( "current step advance to %d" % self.current_step_index )
+                self.debug_print("current step advance to %d" % self.current_step_index)
             else :
-                self.start_shutting_down ( "on_connections_closed: unexpected action fn %s" % action['fn'] )
+                self.start_shutting_down("on_connections_closed: unexpected action fn %s" % action['fn'])
 
-
-    def print_receiver_distribution ( self ) :
+    def print_receiver_distribution(self) :
         print("receiver distribution:")
         for router in range(len(self.router_cnx_counts)) :
             print("    router %s" % router)
@@ -3217,23 +3098,22 @@
                 print("        cnx: %s receivers: %s"
                       % (cnx, cnx_dict[cnx]))
 
-
-    def get_receiver_distribution ( self ) :
+    def get_receiver_distribution(self) :
         threeple = ()
         for router in range(len(self.router_cnx_counts)) :
             cnx_dict = self.router_cnx_counts[router]
             sum_for_this_router = 0
             for cnx in cnx_dict :
                 sum_for_this_router += cnx_dict[cnx]
-            threeple = threeple + ( sum_for_this_router, )
+            threeple = threeple + (sum_for_this_router, )
         return threeple
 
-    #=====================================================
+    # =====================================================
     # Check the count of how many receivers came in for
     # each connection compared to what was expected.
-    #=====================================================
-    def check_receiver_distribution ( self, expected_receiver_counts ) :
-        self.debug_print ( "check_receiver_distribution expecting: %s" % str(expected_receiver_counts) )
+    # =====================================================
+    def check_receiver_distribution(self, expected_receiver_counts) :
+        self.debug_print("check_receiver_distribution expecting: %s" % str(expected_receiver_counts))
         if self.debug :
             self.print_receiver_distribution()
         for router in range(len(self.router_cnx_counts)) :
@@ -3246,13 +3126,12 @@
 
             expected = expected_receiver_counts[router]
             if actual != expected :
-                return "expected: %s -- got: %s" % ( str(expected_receiver_counts), str(self.get_receiver_distribution()) )
+                return "expected: %s -- got: %s" % (str(expected_receiver_counts), str(self.get_receiver_distribution()))
             router += 1
-        self.debug_print ( "expected: %s -- got: %s" % ( str(expected_receiver_counts), str(self.get_receiver_distribution()) ) )
+        self.debug_print("expected: %s -- got: %s" % (str(expected_receiver_counts), str(self.get_receiver_distribution())))
         return None
 
-
-    def close_route_container_connections ( self ) :
+    def close_route_container_connections(self) :
         self.status = "closing route container connections"
         for router in range(len(self.router_cnx_counts)) :
             cnx_dict = self.router_cnx_counts[router]
@@ -3260,36 +3139,33 @@
                 if self.cnx_status[cnx] :
                     cnx.close()
 
-
-    def close_route_container_connections_on_router_n ( self, n ) :
+    def close_route_container_connections_on_router_n(self, n) :
         self.status = "closing route container connections on router %d" % n
-        self.debug_print ( "close_route_container_connections_on_router_n %d" % n )
+        self.debug_print("close_route_container_connections_on_router_n %d" % n)
         cnx_dict = self.router_cnx_counts[n]
         for cnx in cnx_dict :
             if self.cnx_status[cnx] :
                 cnx.close()
 
-
-    #=====================================================================
+    # =====================================================================
     # When a new receiver is handed to us (because a link-attach from a
     # sender has been routed to one of our route-container connections)
     # increment the number associated with that connection.
     # Also indicate to the caller whether this was indeed one of the
     # route-container connections that we made.
-    #=====================================================================
-    def increment_router_cnx_receiver_count ( self, new_cnx ) :
+    # =====================================================================
+    def increment_router_cnx_receiver_count(self, new_cnx) :
         for router in range(len(self.router_cnx_counts)) :
             cnx_dict = self.router_cnx_counts[router]
             for cnx in cnx_dict :
                 if cnx == new_cnx :
                     # This cnx has been awarded a new receiver.
                     cnx_dict[cnx] += 1
-                    self.debug_print ( "receiver went to router %d" % router )
+                    self.debug_print("receiver went to router %d" % router)
                     return True
         return False
 
-
-    def this_is_one_of_my_connections ( self, test_cnx ) :
+    def this_is_one_of_my_connections(self, test_cnx) :
         for router in range(len((self.router_cnx_counts))) :
             cnx_dict = self.router_cnx_counts[router]
             for cnx in cnx_dict :
@@ -3297,11 +3173,10 @@
                     return True
         return False
 
-
-    def on_link_opened ( self, event ):
-        self.debug_print ( "on_link_opened -------------" )
+    def on_link_opened(self, event):
+        self.debug_print("on_link_opened -------------")
         if self.done :
-          return
+            return
 
         if event.receiver == self.linkroute_check_receiver:
             # STEP 3 : the link for our address-checker is now opening and
@@ -3312,60 +3187,57 @@
 
             # If the linkroute readiness checker can't strike oil in 30
             # tries, we are seriously out of luck, and will soon time out.
-            event.receiver.flow ( 30 )
+            event.receiver.flow(30)
             self.linkroute_checker = AddressChecker(self.linkroute_check_receiver.remote_source.address)
             self.linkroute_check()
         else :
-          if event.receiver :
-              # STEP 6 : This receiver-link has been given to us because
-              # a link-attach from one of our senders got routed somewhere.
-              # Note where it got routed to, and count it. This count will
-              # be compared to what was expected. This comparison is the
-              # purpose of this test.
-              this_is_one_of_mine = self.increment_router_cnx_receiver_count ( event.receiver.connection )
-              if this_is_one_of_mine :
-                  self.receiver_count += 1
-                  self.debug_print ( "on_link_opened: got %d of %d expected receivers." % (self.receiver_count, self.expected_receivers) )
-                  if self.receiver_count == self.expected_receivers :
-                      self.event_injector.trigger ( self.got_receivers_event )
+            if event.receiver :
+                # STEP 6 : This receiver-link has been given to us because
+                # a link-attach from one of our senders got routed somewhere.
+                # Note where it got routed to, and count it. This count will
+                # be compared to what was expected. This comparison is the
+                # purpose of this test.
+                this_is_one_of_mine = self.increment_router_cnx_receiver_count(event.receiver.connection)
+                if this_is_one_of_mine :
+                    self.receiver_count += 1
+                    self.debug_print("on_link_opened: got %d of %d expected receivers." % (self.receiver_count, self.expected_receivers))
+                    if self.receiver_count == self.expected_receivers :
+                        self.event_injector.trigger(self.got_receivers_event)
 
-
-    def on_connection_closed ( self, event ):
-        self.debug_print ( "on_connection_closed -------------" )
-        if self.this_is_one_of_my_connections ( event.connection ) :
+    def on_connection_closed(self, event):
+        self.debug_print("on_connection_closed -------------")
+        if self.this_is_one_of_my_connections(event.connection) :
             self.cnx_status[event.connection] = 0
             self.connections_closed += 1
             if self.connections_to_be_closed :
-                self.debug_print ( "on_connection_closed : %d of %d closed : %s" % (self.connections_closed, self.connections_to_be_closed, str(event.connection)) )
+                self.debug_print("on_connection_closed : %d of %d closed : %s" % (self.connections_closed, self.connections_to_be_closed, str(event.connection)))
                 if self.connections_closed == self.connections_to_be_closed :
                     # Reset both of these counters here, because
                     # they are only used each time we get a 'close connections'
                     # instruction, to keep track of its progress.
                     self.connections_to_be_closed = 0
                     self.cconnections_closed      = 0
-                    self.event_injector.trigger ( self.connections_closed_event )
+                    self.event_injector.trigger(self.connections_closed_event)
 
-
-    #=================================================
+    # =================================================
     # All senders get attached to the first router.
-    #=================================================
-    def make_senders ( self, n ):
-        self.debug_print ( "making %d senders" % n )
+    # =================================================
+    def make_senders(self, n):
+        self.debug_print("making %d senders" % n)
         for i in range(n):
-            sender = self.sender_container.create_sender ( self.sender_cnx,
-                                                           self.link_routable_address,
-                                                           name=link_name()
+            sender = self.sender_container.create_sender(self.sender_cnx,
+                                                         self.link_routable_address,
+                                                         name=link_name()
                                                          )
-            self.my_senders.append ( sender )
+            self.my_senders.append(sender)
 
-
-    #=================================================================
+    # =================================================================
     # The only messages I care about in this test are the management
     # ones I send to determine when the router network is ready
     # to start routing my sender-attaches.
-    #=================================================================
-    def on_message ( self, event ):
-        self.debug_print ( "on_message -------------" )
+    # =================================================================
+    def on_message(self, event):
+        self.debug_print("on_message -------------")
         if event.receiver == self.linkroute_check_receiver:
 
             # STEP 4 : we have a response to our management query, to see
@@ -3373,13 +3245,13 @@
             #          The checker will parse it for us, and the caller of
             #          this test has told us how many local containers and
             #          how many remote receivers to expect for our address.
-            response = self.linkroute_checker.parse_address_query_response ( event.message )
+            response = self.linkroute_checker.parse_address_query_response(event.message)
             self.linkroute_check_count += 1
 
-            self.debug_print ( "on_message: got %d local %d remote" % (response.containerCount, response.remoteCount) )
+            self.debug_print("on_message: got %d local %d remote" % (response.containerCount, response.remoteCount))
 
-            if self.done != True                                  and \
-               response.status_code == 200                        and \
+            if self.done != True and \
+               response.status_code == 200 and \
                response.containerCount >= self.n_local_containers and \
                response.remoteCount >= self.n_remote_routers :
                 # We are at the start of the test, looking for the
@@ -3389,22 +3261,21 @@
                 # event once.
                 if not self.sent_address_ready :
                     self.sender_container = event.container
-                    self.event_injector.trigger ( self.address_ready_event )
+                    self.event_injector.trigger(self.address_ready_event)
                     self.status = "address ready"
-                    self.sent_address_ready = True;
-            elif self.done == True                   and \
-                 response.status_code == 200         and \
-                 self.waiting_for_address_to_go_away and \
-                 response.containerCount == 0        and \
-                 response.remoteCount == 0 :
+                    self.sent_address_ready = True
+            elif self.done and \
+                    response.status_code == 200 and \
+                    self.waiting_for_address_to_go_away and \
+                    response.containerCount == 0 and \
+                    response.remoteCount == 0 :
                 # We are at the end of the test, looking for the
                 # address to be forgotten to use all over the network.
-                self.finish ( )
+                self.finish()
 
-            self.linkroute_check_timer = event.reactor.schedule ( 0.25, AddressCheckerTimeout(self))
+            self.linkroute_check_timer = event.reactor.schedule(0.25, AddressCheckerTimeout(self))
 
-
-    #==========================================================================
+    # ==========================================================================
     # Send the message that will query the management code to discover
     # information about our destination address. We cannot make our payload
     # sender until the network is ready.
@@ -3412,11 +3283,10 @@
     # BUGALERT: We have to prepend the 'D' to this linkroute prefix
     # because that's what the router does internally.  Someday this
     # may change.
-    #==========================================================================
-    def linkroute_check ( self ):
+    # ==========================================================================
+    def linkroute_check(self):
         self.status = "waiting for address to be ready"
-        self.linkroute_check_sender.send ( self.linkroute_checker.make_address_query("D" + self.linkroute_prefix) )
-
+        self.linkroute_check_sender.send(self.linkroute_checker.make_address_query("D" + self.linkroute_prefix))
 
     def run(self):
         container = Container(self)
@@ -3424,11 +3294,7 @@
         container.run()
 
 
-
-
-
-
-class WaypointTest ( MessagingHandler ):
+class WaypointTest (MessagingHandler):
     """
     Messages from a client sender to a client receiver are first
     diverted out of the router into a separate waypoint receiver,
@@ -3437,13 +3303,14 @@
     The message then returns from the waypoint sender back to the
     router, and then arrives at the client receiver.
     """
-    def __init__ ( self,
-                   test_name,
-                   container_id,
-                   client_host_1,
-                   client_host_2,
-                   route_container_host,
-                   destination
+
+    def __init__(self,
+                 test_name,
+                 container_id,
+                 client_host_1,
+                 client_host_2,
+                 route_container_host,
+                 destination
                  ):
         super(WaypointTest, self).__init__()
         self.client_host_1        = client_host_1
@@ -3462,29 +3329,29 @@
         self.messages_per_sender = 10
 
         self.senders   = [
-                           {
-                             'sender'  : None,
-                             'to_send' : 0,
-                             'n_sent'  : 0
-                           },
+            {
+                'sender'  : None,
+                'to_send' : 0,
+                'n_sent'  : 0
+            },
 
-                           {
-                             'sender'  : None,
-                             'to_send' : 0,
-                             'n_sent'  : 0
-                           }
-                         ]
+            {
+                'sender'  : None,
+                'to_send' : 0,
+                'n_sent'  : 0
+            }
+        ]
         self.receivers = [
-                           {
-                             'receiver'   : None,
-                             'n_received' : 0
-                           },
+            {
+                'receiver'   : None,
+                'n_received' : 0
+            },
 
-                           {
-                             'receiver'   : None,
-                             'n_received' : 0
-                           }
-                         ]
+            {
+                'receiver'   : None,
+                'n_received' : 0
+            }
+        ]
 
         self.n_sent     = 0
         self.n_rcvd     = 0
@@ -3503,148 +3370,131 @@
         self.debug     = False
         self.test_name = test_name
 
-
     def timeout(self):
-        self.bail ( "Timeout Expired: n_sent=%d n_rcvd=%d n_thru=%d" % (self.n_sent, self.n_rcvd, self.n_thru) )
+        self.bail("Timeout Expired: n_sent=%d n_rcvd=%d n_thru=%d" % (self.n_sent, self.n_rcvd, self.n_thru))
 
-
-
-    def bail ( self, text ):
+    def bail(self, text):
         self.error = text
         self.route_container_connection.close()
         self.client_connection.close()
         self.timer.cancel()
 
-
-
-    def debug_print ( self, message ) :
+    def debug_print(self, message) :
         if self.debug :
             print(message)
 
-
-
-    def send_from_client ( self, sender, n_messages, sender_index ):
+    def send_from_client(self, sender, n_messages, sender_index):
         n_sent = 0
-        self.debug_print ( "send_from_client -------------------" );
+        self.debug_print("send_from_client -------------------")
         while sender.credit > 0 and n_sent < n_messages:
             n_sent      += 1
             self.n_sent += 1
-            msg = Message ( body=n_sent )
-            self.debug_print ( "    send_from_client -- sender: %d n_sent: %d" % ( sender_index, n_sent ) )
-            sender.send ( msg )
+            msg = Message(body=n_sent)
+            self.debug_print("    send_from_client -- sender: %d n_sent: %d" % (sender_index, n_sent))
+            sender.send(msg)
             # We send from a client
             self.n_transitions += 1
 
-
-
-    def send_from_waypoint ( self ):
-        self.debug_print ( "send_from_waypoint ---------------------" )
+    def send_from_waypoint(self):
+        self.debug_print("send_from_waypoint ---------------------")
 
         if len(self.waypoint_queue) <= 0 :
-          self.debug_print ( "    waypoint queue is empty." )
-          return
+            self.debug_print("    waypoint queue is empty.")
+            return
 
         while self.waypoint_sender.credit > 0 and len(self.waypoint_queue) > 0:
             m = self.waypoint_queue.pop()
             message_content_number = m.body
-            self.debug_print ( "    send_from_waypoint num is %d " % message_content_number )
-            self.waypoint_sender.send ( m )
+            self.debug_print("    send_from_waypoint num is %d " % message_content_number)
+            self.waypoint_sender.send(m)
             self.n_thru += 1
             # We send from a waypoint.
             self.n_transitions += 1
 
-
-
-    def on_start ( self, event ):
-        self.timer = event.reactor.schedule ( TIMEOUT, TestTimeout(self) )
-        self.client_connection = event.container.connect ( self.client_host_1 )
+    def on_start(self, event):
+        self.timer = event.reactor.schedule(TIMEOUT, TestTimeout(self))
+        self.client_connection = event.container.connect(self.client_host_1)
 
         # Creating this connection is what gets things started.  When we make this
         # connection to a route container address, the router will look at our
         # containerId, and will at that time instantiate any associated autolinks.
-        self.route_container_connection = event.container.connect ( self.route_container_host )
+        self.route_container_connection = event.container.connect(self.route_container_host)
 
-        self.debug_print ( "    creating clients for connection" )
+        self.debug_print("    creating clients for connection")
         for i in range(len(self.senders)) :
             sender   = self.senders[i]
             receiver = self.receivers[i]
 
-            sender['sender'] = event.container.create_sender ( self.client_connection,
-                                                               self.destination,
-                                                               name=link_name() )
+            sender['sender'] = event.container.create_sender(self.client_connection,
+                                                             self.destination,
+                                                             name=link_name())
             sender['to_send'] = self.messages_per_sender
             sender['n_sent']  = 0
 
-            receiver['receiver'] = event.container.create_receiver ( self.client_connection,
-                                                                     self.destination,
-                                                                     name=link_name() )
+            receiver['receiver'] = event.container.create_receiver(self.client_connection,
+                                                                   self.destination,
+                                                                   name=link_name())
             receiver['n_received'] = 0
 
-
-
     def on_link_opening(self, event):
-        self.debug_print ( "on_link_opening -------------------------- " )
+        self.debug_print("on_link_opening -------------------------- ")
         if event.sender:
-            self.debug_print ( "    sender: %s" % event.sender.remote_source.address )
+            self.debug_print("    sender: %s" % event.sender.remote_source.address)
             event.sender.source.address = event.sender.remote_source.address
             event.sender.open()
             if event.sender.remote_source.address == self.destination:
-                self.debug_print ( "    that's one of my waypoint senders: %s" % self.destination )
+                self.debug_print("    that's one of my waypoint senders: %s" % self.destination)
                 self.waypoint_sender = event.sender
 
         elif event.receiver:
-            self.debug_print ( "    receiver: %s" % event.receiver.remote_target.address )
+            self.debug_print("    receiver: %s" % event.receiver.remote_target.address)
             event.receiver.target.address = event.receiver.remote_target.address
             event.receiver.open()
             if event.receiver.remote_target.address == self.destination:
-                self.debug_print ( "    that's one of mine." )
+                self.debug_print("    that's one of mine.")
                 self.waypoint_receiver = event.receiver
-                self.waypoint_receiver.flow ( 1000 )
+                self.waypoint_receiver.flow(1000)
 
-
-
-    def on_sendable ( self, event ):
-        self.debug_print ( "on_sendable ---------------------------- " )
+    def on_sendable(self, event):
+        self.debug_print("on_sendable ---------------------------- ")
         for i in range(len(self.senders)) :
             sender = self.senders[i]
             if sender['sender'] == event.sender :
                 if sender['n_sent'] < sender['to_send'] :
-                    self.send_from_client ( sender['sender'], sender['to_send'], i )
+                    self.send_from_client(sender['sender'], sender['to_send'], i)
                     sender['n_sent'] = sender['to_send']
-                    self.debug_print ( "    sent %d" % sender['n_sent'] )
+                    self.debug_print("    sent %d" % sender['n_sent'])
                     return
         if event.sender == self.waypoint_sender :
-            self.send_from_waypoint ( )
+            self.send_from_waypoint()
 
-
-    def on_message ( self, event ):
-        self.debug_print ( "on_message ---------------------------- " )
+    def on_message(self, event):
+        self.debug_print("on_message ---------------------------- ")
         if event.receiver == self.waypoint_receiver :
-            self.debug_print ( "    waypoint receiver" )
+            self.debug_print("    waypoint receiver")
             m = Message(body=event.message.body)
             # We receive to a waypoint.
             self.n_transitions += 1
             self.waypoint_queue.append(m)
-            self.debug_print ( "    queue depth is now %d" % len(self.waypoint_queue) )
-            self.send_from_waypoint ( )
+            self.debug_print("    queue depth is now %d" % len(self.waypoint_queue))
+            self.send_from_waypoint()
         else :
             for i in range(len(self.receivers)) :
-                self.debug_print ( "    client receiver" )
+                self.debug_print("    client receiver")
                 receiver = self.receivers[i]
                 if event.receiver == receiver['receiver'] :
                     message_content_number = event.message.body
                     receiver['n_received'] += 1
                     # We receive to a client.
                     self.n_transitions += 1
-                    self.debug_print ( "    client receiver %d has %d messages." % ( i, receiver['n_received'] ) )
+                    self.debug_print("    client receiver %d has %d messages." % (i, receiver['n_received']))
                     self.n_rcvd += 1
                     if self.n_rcvd >= self.n_expected and self.n_thru >= self.n_expected:
                         if self.n_transitions != self.n_expected_transitions :
-                            self.bail ( "expected %d transitions, but got %d" % ( self.n_expected_transitions, self.n_transitions ) )
+                            self.bail("expected %d transitions, but got %d" % (self.n_expected_transitions, self.n_transitions))
                         else :
-                            self.debug_print ( "    success" )
-                            self.bail ( None )
-
+                            self.debug_print("    success")
+                            self.bail(None)
 
     def run(self):
         container = Container(self)
@@ -3652,10 +3502,7 @@
         container.run()
 
 
-
-
-
-class SerialWaypointTest ( MessagingHandler ):
+class SerialWaypointTest (MessagingHandler):
     """
     Messages from a client sender on their way to a client receiver are
     first re-routed to two separate waypoint 'processes', in serial.
@@ -3664,13 +3511,14 @@
     senders that pop them off the fifos and send them.  This simulates
     either a broker, or some arbitrary processing on the message.
     """
-    def __init__ ( self,
-                   test_name,
-                   container_id,
-                   client_host_1,
-                   client_host_2,
-                   route_container_host,
-                   destination
+
+    def __init__(self,
+                 test_name,
+                 container_id,
+                 client_host_1,
+                 client_host_2,
+                 route_container_host,
+                 destination
                  ):
         super(SerialWaypointTest, self).__init__()
         self.client_host_1        = client_host_1
@@ -3684,53 +3532,52 @@
 
         self.route_container_connection = None
 
-
         # There are 2 sending clients and 2 receiving clients
         # only because I wanted to have more than 1, and 2
         # appeared to be the next available integer.
         # This has nothing to do with the fact that there are
         # 2 waypoints.
         self.senders = [
-                         { 'sender'  : None,
-                           'to_send' : self.messages_per_sender,
-                           'n_sent'  : 0
-                         },
-                         { 'sender'  : None,
-                           'to_send' : self.messages_per_sender,
-                           'n_sent'  : 0
-                         }
-                       ]
+            {'sender'  : None,
+             'to_send' : self.messages_per_sender,
+             'n_sent'  : 0
+             },
+            {'sender'  : None,
+             'to_send' : self.messages_per_sender,
+             'n_sent'  : 0
+             }
+        ]
 
         self.receivers = [
-                           { 'receiver'   : None,
-                             'n_received' : 0
-                           },
-                           { 'receiver'   : None,
-                             'n_received' : 0
-                           }
-                         ]
+            {'receiver'   : None,
+             'n_received' : 0
+             },
+            {'receiver'   : None,
+             'n_received' : 0
+             }
+        ]
 
         self.n_waypoint_senders   = 0
         self.n_waypoint_receivers = 0
 
         self.waypoints = [
-                           { 'sender'     : None,
-                             'n_sent'     : 0,
-                             'receiver'   : None,
-                             'n_received' : 0,
-                             'queue'      : [],
-                             'n_sent'     : 0,
-                             'name'       : '1'
-                           },
-                           { 'sender'     : None,
-                             'n_sent'     : 0,
-                             'receiver'   : None,
-                             'n_received' : 0,
-                             'queue'      : [],
-                             'n_sent'     : 0,
-                             'name'       : '2'
-                           }
-                         ]
+            {'sender'     : None,
+             'n_sent'     : 0,
+             'receiver'   : None,
+             'n_received' : 0,
+             'queue'      : [],
+             'n_sent'     : 0,
+             'name'       : '1'
+             },
+            {'sender'     : None,
+             'n_sent'     : 0,
+             'receiver'   : None,
+             'n_received' : 0,
+             'queue'      : [],
+             'n_sent'     : 0,
+             'name'       : '2'
+             }
+        ]
 
         self.n_sent = 0
         self.n_rcvd = 0
@@ -3748,128 +3595,115 @@
         self.debug     = False
         self.test_name = test_name
 
-
     def timeout(self):
-        self.bail ( "Timeout Expired: n_sent=%d n_rcvd=%d n_thru=%d" % (self.n_sent, self.n_rcvd, self.n_thru) )
+        self.bail("Timeout Expired: n_sent=%d n_rcvd=%d n_thru=%d" % (self.n_sent, self.n_rcvd, self.n_thru))
 
-
-    def bail ( self, text ):
+    def bail(self, text):
         self.error = text
         self.route_container_connection.close()
         for cnx in self.sender_connections :
-          cnx.close()
+            cnx.close()
         self.timer.cancel()
 
-
-    def debug_print ( self, message ) :
+    def debug_print(self, message) :
         if self.debug :
             print(message)
 
-
-    def send_from_client ( self, sender, n_messages, sender_index ):
+    def send_from_client(self, sender, n_messages, sender_index):
         n_sent = 0
         while sender.credit > 0 and n_sent < n_messages:
-            msg = Message ( body=n_sent )
-            sender.send ( msg )
+            msg = Message(body=n_sent)
+            sender.send(msg)
             n_sent             += 1
             self.n_sent        += 1
             self.n_transitions += 1
-            self.debug_print ( "send_from_client -- sender: %d n_sent: %d" % ( sender_index, n_sent ) )
+            self.debug_print("send_from_client -- sender: %d n_sent: %d" % (sender_index, n_sent))
 
-
-
-    def send_from_waypoint ( self, waypoint ):
-        self.debug_print ( "send_from_waypoint ------------------------------" )
+    def send_from_waypoint(self, waypoint):
+        self.debug_print("send_from_waypoint ------------------------------")
 
         while waypoint['sender'].credit > 0 and len(waypoint['queue']) > 0:
             m = waypoint['queue'].pop()
             message_content_number = m.body
-            waypoint['sender'].send ( m )
+            waypoint['sender'].send(m)
             waypoint['n_sent'] += 1
             self.n_thru        += 1
             self.n_transitions += 1
-            self.debug_print ( "send_from_waypoint %s is %d " % ( waypoint['name'], message_content_number) )
+            self.debug_print("send_from_waypoint %s is %d " % (waypoint['name'], message_content_number))
 
-
-
-    def on_start ( self, event ):
-        self.timer = event.reactor.schedule ( TIMEOUT, TestTimeout(self) )
-        self.sender_connections.append ( event.container.connect(self.client_host_1) )
-        self.sender_connections.append ( event.container.connect(self.client_host_2) )
+    def on_start(self, event):
+        self.timer = event.reactor.schedule(TIMEOUT, TestTimeout(self))
+        self.sender_connections.append(event.container.connect(self.client_host_1))
+        self.sender_connections.append(event.container.connect(self.client_host_2))
         # Creating this connection is what gets things started.  When we make this
         # connection to a route container address, the router will look at our
         # containerId, and will at that time instantiate any associated autolinks.
-        self.route_container_connection = event.container.connect ( self.route_container_host )
-
+        self.route_container_connection = event.container.connect(self.route_container_host)
 
         for i in range(len(self.sender_connections)) :
             cnx = self.sender_connections[i]
             sender   = self.senders[i]
             receiver = self.receivers[i]
 
-            sender['sender'] = event.container.create_sender ( cnx,
-                                                               self.destination,
-                                                               name=link_name() )
+            sender['sender'] = event.container.create_sender(cnx,
+                                                             self.destination,
+                                                             name=link_name())
             sender['to_send'] = self.messages_per_sender
             sender['n_sent']  = 0
 
-            receiver['receiver'] = event.container.create_receiver ( cnx,
-                                                                     self.destination,
-                                                                     name=link_name() )
+            receiver['receiver'] = event.container.create_receiver(cnx,
+                                                                   self.destination,
+                                                                   name=link_name())
             receiver['n_received'] = 0
 
+    def on_link_opening(self, event):
 
-    def on_link_opening ( self, event ):
-
-        self.debug_print ( "on_link_opening -------------------------- " )
+        self.debug_print("on_link_opening -------------------------- ")
 
         if event.sender:
-            self.debug_print ( "    sender: %s" % event.sender.remote_source.address )
+            self.debug_print("    sender: %s" % event.sender.remote_source.address)
             event.sender.source.address = event.sender.remote_source.address
             event.sender.open()
             if event.sender.remote_source.address == self.destination:
                 if self.n_waypoint_senders < 2 :
-                    self.debug_print ( "    store this as one of my waypoint senders." )
+                    self.debug_print("    store this as one of my waypoint senders.")
                     self.waypoints[self.n_waypoint_senders]['sender'] = event.sender
                     self.n_waypoint_senders += 1
 
         elif event.receiver:
-            self.debug_print ( "    receiver: %s" % event.receiver.remote_target.address )
+            self.debug_print("    receiver: %s" % event.receiver.remote_target.address)
             event.receiver.target.address = event.receiver.remote_target.address
             event.receiver.open()
             if event.receiver.remote_target.address == self.destination:
-                self.debug_print ( "    store this as one of my waypoint receivers." )
+                self.debug_print("    store this as one of my waypoint receivers.")
                 if self.n_waypoint_receivers < 2 :
                     self.waypoints[self.n_waypoint_receivers]['receiver'] = event.receiver
                     self.n_waypoint_receivers += 1
 
-
-
-    def on_sendable ( self, event ):
-        self.debug_print ( "on_sendable ------------------------------" )
+    def on_sendable(self, event):
+        self.debug_print("on_sendable ------------------------------")
         for index in range(len(self.senders)) :
             sender = self.senders[index]
             if event.sender == sender['sender'] :
-                self.debug_print ( "    client sender %d" % index )
+                self.debug_print("    client sender %d" % index)
                 if sender['n_sent'] < sender['to_send'] :
-                    self.debug_print ( "    sending %d" % sender['to_send'] )
-                    self.send_from_client ( sender['sender'], sender['to_send'], index )
+                    self.debug_print("    sending %d" % sender['to_send'])
+                    self.send_from_client(sender['sender'], sender['to_send'], index)
                     sender['n_sent'] = sender['to_send']  # n_sent = n_to_send
                 else :
-                    self.debug_print ( "    this sender is already finished." )
+                    self.debug_print("    this sender is already finished.")
                 return
 
         for j in range(len(self.waypoints)) :
             sender = self.waypoints[j]['sender']
             if event.sender == sender :
-                self.debug_print ( "    waypoint_sender %d" % j )
-                self.send_from_waypoint ( self.waypoints[j] )
+                self.debug_print("    waypoint_sender %d" % j)
+                self.send_from_waypoint(self.waypoints[j])
                 return
 
-
     def on_message(self, event):
 
-        self.debug_print ( "on_message --------------------------- " )
+        self.debug_print("on_message --------------------------- ")
 
         # Is this one of our client receivers ?
         for i in range(len(self.receivers)) :
@@ -3877,33 +3711,31 @@
             if event.receiver == receiver['receiver'] :
                 receiver['n_received'] += 1
                 self.n_transitions     += 1
-                self.debug_print ("    client receiver %d has %d messages." % ( i, receiver['n_received'] ) )
+                self.debug_print("    client receiver %d has %d messages." % (i, receiver['n_received']))
                 message_content_number = event.message.body
                 self.n_rcvd += 1
                 if self.n_rcvd >= self.n_expected_received and self.n_thru >= self.n_expected_received:
-                    self.debug_print ( "DONE -- self.n_rcvd: %d   self.n_thru: %d" % ( self.n_rcvd, self.n_thru ) )
+                    self.debug_print("DONE -- self.n_rcvd: %d   self.n_thru: %d" % (self.n_rcvd, self.n_thru))
                     if self.debug :
-                        self.report ( )
-                    self.check_results_and_bail ( )
+                        self.report()
+                    self.check_results_and_bail()
                     return
 
         # Is this one of our waypoint receivers ?
         for j in range(len(self.waypoints)) :
             waypoint = self.waypoints[j]
             if event.receiver == waypoint['receiver'] :
-                m = Message ( body=event.message.body )
-                waypoint [ 'queue' ].append ( m )
-                waypoint [ 'n_received' ] += 1
+                m = Message(body=event.message.body)
+                waypoint['queue'].append(m)
+                waypoint['n_received'] += 1
                 self.n_transitions        += 1
-                self.debug_print ( "    message received at waypoint %d, queue depth is now %d" % (j, len(waypoint['queue'])))
-                self.send_from_waypoint ( waypoint )
+                self.debug_print("    message received at waypoint %d, queue depth is now %d" % (j, len(waypoint['queue'])))
+                self.send_from_waypoint(waypoint)
 
-
-
-    def check_results_and_bail ( self ) :
+    def check_results_and_bail(self) :
 
         if self.n_expected_transitions != self.n_transitions :
-            self.bail ( "total transitions were %d, but %d were expected." % ( self.n_transitions, self.n_expected_transitions ) )
+            self.bail("total transitions were %d, but %d were expected." % (self.n_transitions, self.n_expected_transitions))
             return
 
         mps                 = self.messages_per_sender
@@ -3918,8 +3750,8 @@
         for i in range(n_senders) :
             sndr = self.senders[i]
             if sndr['n_sent'] != mps :
-              self.bail ( "sender %d sent %d messages instead of %d" % ( i, sndr['n_sent'], mps ) )
-              return
+                self.bail("sender %d sent %d messages instead of %d" % (i, sndr['n_sent'], mps))
+                return
 
         n_waypoints = len(self.waypoints)
         total_expected_waypoint_receptions = total_messages_sent * n_waypoints
@@ -3929,7 +3761,7 @@
             total_actual_waypoint_receptions += self.waypoints[i]['n_received']
 
         if total_actual_waypoint_receptions != total_expected_waypoint_receptions :
-            self.bail ( "total waypoint receptions were %d, but %d were expected." % ( total_actual_waypoint_receptions, total_expected_waypoint_receptions) )
+            self.bail("total waypoint receptions were %d, but %d were expected." % (total_actual_waypoint_receptions, total_expected_waypoint_receptions))
             return
 
         total_messages_received = 0
@@ -3938,44 +3770,38 @@
             total_messages_received += this_receiver_got
 
         if total_messages_received != total_messages_sent :
-            self.bail ( "total_messages_received: %d but %d were expected." % (total_messages_received, total_messages_sent) )
+            self.bail("total_messages_received: %d but %d were expected." % (total_messages_received, total_messages_sent))
             return
 
-        self.debug_print ( "\nsuccess\n" )
-        self.bail ( None )
+        self.debug_print("\nsuccess\n")
+        self.bail(None)
 
-
-
-    def report ( self ) :
+    def report(self) :
         print("\n\n==========================================================\nreport\n")
 
         for i in range(len(self.senders)) :
-            print("    client sender %d sent %d messages." % ( i, self.senders[i]['n_sent']))
+            print("    client sender %d sent %d messages." % (i, self.senders[i]['n_sent']))
 
         print("\n")
 
         for i in range(len(self.waypoints)) :
-            print("    waypoint %d received %d messages." % ( i, self.waypoints[i]['n_received']))
-            print("    waypoint %d sent     %d messages." % ( i, self.waypoints[i]['n_sent']))
+            print("    waypoint %d received %d messages." % (i, self.waypoints[i]['n_received']))
+            print("    waypoint %d sent     %d messages." % (i, self.waypoints[i]['n_sent']))
 
         print("\n")
 
         for i in range(len(self.receivers)) :
-            print("    client receiver %d received %d messages." % ( i, self.receivers[i]['n_received'] ))
+            print("    client receiver %d received %d messages." % (i, self.receivers[i]['n_received']))
 
         print("\nend report\n=========================================================\n\n")
 
-
-
     def run(self):
         container = Container(self)
         container.container_id = self.container_id
         container.run()
 
 
-
-
-class ParallelWaypointTest ( MessagingHandler ):
+class ParallelWaypointTest (MessagingHandler):
     """
     Messages from a client sender on their way to a client receiver are
     first re-routed to one of two separate waypoint 'processes', in parallel.
@@ -3984,15 +3810,16 @@
     senders that pop them off the fifos and send them.  This simulates
     either a broker, or some arbitrary processing on the message.
     """
-    def __init__ ( self,
-                   test_name,
-                   container_id,
-                   client_host_1,
-                   client_host_2,
-                   route_container_host,
-                   destination
+
+    def __init__(self,
+                 test_name,
+                 container_id,
+                 client_host_1,
+                 client_host_2,
+                 route_container_host,
+                 destination
                  ):
-        super ( ParallelWaypointTest, self ). __init__()
+        super(ParallelWaypointTest, self). __init__()
         self.client_host_1        = client_host_1
         self.client_host_2        = client_host_2
         self.route_container_host = route_container_host
@@ -4005,46 +3832,46 @@
         self.route_container_connection = None
 
         self.senders = [
-                         { 'sender'  : None,
-                           'to_send' : self.messages_per_sender,
-                           'n_sent'  : 0
-                         },
-                         { 'sender'  : None,
-                           'to_send' : self.messages_per_sender,
-                           'n_sent'  : 0
-                         }
-                       ]
+            {'sender'  : None,
+             'to_send' : self.messages_per_sender,
+             'n_sent'  : 0
+             },
+            {'sender'  : None,
+             'to_send' : self.messages_per_sender,
+             'n_sent'  : 0
+             }
+        ]
 
         self.receivers = [
-                           { 'receiver'   : None,
-                             'n_received' : 0
-                           },
-                           { 'receiver'   : None,
-                             'n_received' : 0
-                           }
-                         ]
+            {'receiver'   : None,
+             'n_received' : 0
+             },
+            {'receiver'   : None,
+             'n_received' : 0
+             }
+        ]
 
         self.n_waypoint_senders   = 0
         self.n_waypoint_receivers = 0
 
         self.waypoints = [
-                           { 'sender'     : None,
-                             'n_sent'     : 0,
-                             'receiver'   : None,
-                             'n_received' : 0,
-                             'queue'      : [],
-                             'n_sent'     : 0,
-                             'name'       : '1'
-                           },
-                           { 'sender'     : None,
-                             'n_sent'     : 0,
-                             'receiver'   : None,
-                             'n_received' : 0,
-                             'queue'      : [],
-                             'n_sent'     : 0,
-                             'name'       : '2'
-                           }
-                         ]
+            {'sender'     : None,
+             'n_sent'     : 0,
+             'receiver'   : None,
+             'n_received' : 0,
+             'queue'      : [],
+             'n_sent'     : 0,
+             'name'       : '1'
+             },
+            {'sender'     : None,
+             'n_sent'     : 0,
+             'receiver'   : None,
+             'n_received' : 0,
+             'queue'      : [],
+             'n_sent'     : 0,
+             'name'       : '2'
+             }
+        ]
 
         self.n_sent = 0
         self.n_rcvd = 0
@@ -4063,127 +3890,115 @@
 
         self.test_name = test_name
 
-
     def timeout(self):
-        self.bail ( "Timeout Expired: n_sent=%d n_rcvd=%d n_thru=%d" % (self.n_sent, self.n_rcvd, self.n_thru) )
+        self.bail("Timeout Expired: n_sent=%d n_rcvd=%d n_thru=%d" % (self.n_sent, self.n_rcvd, self.n_thru))
 
-
-    def bail ( self, text ):
+    def bail(self, text):
         self.error = text
         self.route_container_connection.close()
         for cnx in self.sender_connections :
-          cnx.close()
+            cnx.close()
         self.timer.cancel()
 
-
-    def debug_print ( self, message ) :
+    def debug_print(self, message) :
         if self.debug :
             print(message)
 
-
-    def send_from_client ( self, sender, n_messages, sender_index ):
+    def send_from_client(self, sender, n_messages, sender_index):
         n_sent = 0
         while sender.credit > 0 and n_sent < n_messages:
-            msg = Message ( body=n_sent )
-            sender.send ( msg )
+            msg = Message(body=n_sent)
+            sender.send(msg)
             n_sent             += 1
             self.n_sent        += 1
             self.n_transitions += 1
-            self.debug_print ( "send_from_client -- sender: %d n_sent: %d" % ( sender_index, n_sent ) )
+            self.debug_print("send_from_client -- sender: %d n_sent: %d" % (sender_index, n_sent))
 
-
-
-    def send_from_waypoint ( self, waypoint ):
-        self.debug_print ( "send_from_waypoint ------------------------------" )
+    def send_from_waypoint(self, waypoint):
+        self.debug_print("send_from_waypoint ------------------------------")
 
         while waypoint['sender'].credit > 0 and len(waypoint['queue']) > 0:
             m = waypoint['queue'].pop()
             message_content_number = m.body
-            waypoint['sender'].send ( m )
+            waypoint['sender'].send(m)
             waypoint['n_sent'] += 1
             self.n_thru        += 1
             self.n_transitions += 1
-            self.debug_print ( "send_from_waypoint %s is %d " % ( waypoint['name'], message_content_number) )
+            self.debug_print("send_from_waypoint %s is %d " % (waypoint['name'], message_content_number))
 
-
-
-    def on_start ( self, event ):
-        self.timer = event.reactor.schedule ( TIMEOUT, TestTimeout(self) )
-        self.sender_connections.append ( event.container.connect(self.client_host_1) )
-        self.sender_connections.append ( event.container.connect(self.client_host_2) )
+    def on_start(self, event):
+        self.timer = event.reactor.schedule(TIMEOUT, TestTimeout(self))
+        self.sender_connections.append(event.container.connect(self.client_host_1))
+        self.sender_connections.append(event.container.connect(self.client_host_2))
         # Creating this connection is what gets things started.  When we make this
         # connection to a route container address, the router will look at our
         # containerId, and will at that time instantiate any associated autolinks.
         # We will get an 'on_link_opening' for each of them.
-        self.route_container_connection = event.container.connect ( self.route_container_host )
+        self.route_container_connection = event.container.connect(self.route_container_host)
 
         for i in range(len(self.sender_connections)) :
             cnx = self.sender_connections[i]
             sender   = self.senders[i]
             receiver = self.receivers[i]
 
-            sender['sender'] = event.container.create_sender ( cnx,
-                                                               self.destination,
-                                                               name=link_name() )
+            sender['sender'] = event.container.create_sender(cnx,
+                                                             self.destination,
+                                                             name=link_name())
             sender['to_send'] = self.messages_per_sender
             sender['n_sent']  = 0
-            receiver['receiver'] = event.container.create_receiver ( cnx,
-                                                                     self.destination,
-                                                                     name=link_name() )
+            receiver['receiver'] = event.container.create_receiver(cnx,
+                                                                   self.destination,
+                                                                   name=link_name())
             receiver['n_received'] = 0
 
+    def on_link_opening(self, event):
 
-    def on_link_opening ( self, event ):
-
-        self.debug_print ( "on_link_opening -------------------------- " )
+        self.debug_print("on_link_opening -------------------------- ")
 
         if event.sender:
-            self.debug_print ( "    sender: %s" % event.sender.remote_source.address )
+            self.debug_print("    sender: %s" % event.sender.remote_source.address)
             event.sender.source.address = event.sender.remote_source.address
             event.sender.open()
             if event.sender.remote_source.address == self.destination:
                 if self.n_waypoint_senders < 2 :
-                    self.debug_print ( "    store this as one of my waypoint senders." )
+                    self.debug_print("    store this as one of my waypoint senders.")
                     self.waypoints[self.n_waypoint_senders]['sender'] = event.sender
                     self.n_waypoint_senders += 1
 
         elif event.receiver:
-            self.debug_print ( "    receiver: %s" % event.receiver.remote_target.address )
+            self.debug_print("    receiver: %s" % event.receiver.remote_target.address)
             event.receiver.target.address = event.receiver.remote_target.address
             event.receiver.open()
             if event.receiver.remote_target.address == self.destination:
-                self.debug_print ( "    store this as one of my waypoint receivers." )
+                self.debug_print("    store this as one of my waypoint receivers.")
                 if self.n_waypoint_receivers < 2 :
                     self.waypoints[self.n_waypoint_receivers]['receiver'] = event.receiver
                     self.n_waypoint_receivers += 1
 
-
-
-    def on_sendable ( self, event ):
-        self.debug_print ( "on_sendable ------------------------------" )
+    def on_sendable(self, event):
+        self.debug_print("on_sendable ------------------------------")
         for index in range(len(self.senders)) :
             sender = self.senders[index]
             if event.sender == sender['sender'] :
-                self.debug_print ( "    client sender %d" % index )
+                self.debug_print("    client sender %d" % index)
                 if sender['n_sent'] < sender['to_send'] :
-                    self.debug_print ( "    sending %d" % sender['to_send'] )
-                    self.send_from_client ( sender['sender'], sender['to_send'], index )
+                    self.debug_print("    sending %d" % sender['to_send'])
+                    self.send_from_client(sender['sender'], sender['to_send'], index)
                     sender['n_sent'] = sender['to_send']  # n_sent = n_to_send
                 else :
-                    self.debug_print ( "    this sender is already finished." )
+                    self.debug_print("    this sender is already finished.")
                 return
 
         for j in range(len(self.waypoints)) :
             sender = self.waypoints[j]['sender']
             if event.sender == sender :
-                self.debug_print ( "    waypoint_sender %d" % j )
-                self.send_from_waypoint ( self.waypoints[j] )
+                self.debug_print("    waypoint_sender %d" % j)
+                self.send_from_waypoint(self.waypoints[j])
                 return
 
-
     def on_message(self, event):
 
-        self.debug_print ( "on_message --------------------------- " )
+        self.debug_print("on_message --------------------------- ")
 
         # Is this one of our client receivers ?
         for i in range(len(self.receivers)) :
@@ -4191,33 +4006,31 @@
             if event.receiver == receiver['receiver'] :
                 receiver['n_received'] += 1
                 self.n_transitions     += 1
-                self.debug_print ("    client receiver %d has %d messages." % ( i, receiver['n_received'] ) )
+                self.debug_print("    client receiver %d has %d messages." % (i, receiver['n_received']))
                 message_content_number = event.message.body
                 self.n_rcvd += 1
                 if self.n_rcvd >= self.n_expected_received and self.n_thru >= self.n_expected_received:
-                    self.debug_print ( "DONE -- self.n_rcvd: %d   self.n_thru: %d" % ( self.n_rcvd, self.n_thru ) )
+                    self.debug_print("DONE -- self.n_rcvd: %d   self.n_thru: %d" % (self.n_rcvd, self.n_thru))
                     if self.debug :
-                        self.report ( )
-                    self.check_results_and_bail ( )
+                        self.report()
+                    self.check_results_and_bail()
                     return
 
         # Is this one of our waypoint receivers ?
         for j in range(len(self.waypoints)) :
             waypoint = self.waypoints[j]
             if event.receiver == waypoint['receiver'] :
-                m = Message ( body=event.message.body )
-                waypoint [ 'queue' ].append ( m )
-                waypoint [ 'n_received' ] += 1
+                m = Message(body=event.message.body)
+                waypoint['queue'].append(m)
+                waypoint['n_received'] += 1
                 self.n_transitions        += 1
-                self.debug_print ( "    message received at waypoint %d, queue depth is now %d" % (j, len(waypoint['queue'])))
-                self.send_from_waypoint ( waypoint )
+                self.debug_print("    message received at waypoint %d, queue depth is now %d" % (j, len(waypoint['queue'])))
+                self.send_from_waypoint(waypoint)
 
-
-
-    def check_results_and_bail ( self ) :
+    def check_results_and_bail(self) :
 
         if self.n_expected_transitions != self.n_transitions :
-            self.bail ( "total transitions were %d, but %d were expected." % ( self.n_transitions, self.n_expected_transitions ) )
+            self.bail("total transitions were %d, but %d were expected." % (self.n_transitions, self.n_expected_transitions))
             return
 
         mps                 = self.messages_per_sender
@@ -4232,8 +4045,8 @@
         for i in range(n_senders) :
             sndr = self.senders[i]
             if sndr['n_sent'] != mps :
-              self.bail ( "sender %d sent %d messages instead of %d" % ( i, sndr['n_sent'], mps ) )
-              return
+                self.bail("sender %d sent %d messages instead of %d" % (i, sndr['n_sent'], mps))
+                return
 
         n_waypoints = len(self.waypoints)
 
@@ -4247,7 +4060,7 @@
             total_actual_waypoint_receptions += self.waypoints[i]['n_received']
 
         if total_actual_waypoint_receptions != total_expected_waypoint_receptions :
-            self.bail ( "total waypoint receptions were %d, but %d were expected." % ( total_actual_waypoint_receptions, total_expected_waypoint_receptions) )
+            self.bail("total waypoint receptions were %d, but %d were expected." % (total_actual_waypoint_receptions, total_expected_waypoint_receptions))
             return
 
         # Finally, our client receivers must receiv one message
@@ -4258,35 +4071,31 @@
             total_messages_received += this_receiver_got
 
         if total_messages_received != total_messages_sent :
-            self.bail ( "total_messages_received: %d but %d were expected." % (total_messages_received, total_messages_sent) )
+            self.bail("total_messages_received: %d but %d were expected." % (total_messages_received, total_messages_sent))
             return
 
-        self.debug_print ( "\nsuccess\n" )
-        self.bail ( None )
+        self.debug_print("\nsuccess\n")
+        self.bail(None)
 
-
-
-    def report ( self ) :
+    def report(self) :
         print("\n\n==========================================================\nreport\n")
 
         for i in range(len(self.senders)) :
-            print("    client sender %d sent %d messages." % ( i, self.senders[i]['n_sent'] ))
+            print("    client sender %d sent %d messages." % (i, self.senders[i]['n_sent']))
 
         print("\n")
 
         for i in range(len(self.waypoints)) :
-            print("    waypoint %d received %d messages." % ( i, self.waypoints[i]['n_received'] ))
-            print("    waypoint %d sent     %d messages." % ( i, self.waypoints[i]['n_sent'] ))
+            print("    waypoint %d received %d messages." % (i, self.waypoints[i]['n_received']))
+            print("    waypoint %d sent     %d messages." % (i, self.waypoints[i]['n_sent']))
 
         print("\n")
 
         for i in range(len(self.receivers)) :
-            print( "    client receiver %d received %d messages." % ( i, self.receivers[i]['n_received'] ))
+            print("    client receiver %d received %d messages." % (i, self.receivers[i]['n_received']))
 
         print("\nend report\n=========================================================\n\n")
 
-
-
     def run(self):
         container = Container(self)
         container.container_id = self.container_id
diff --git a/tests/system_tests_drain.py b/tests/system_tests_drain.py
index 12faad8..9e2b5e4 100644
--- a/tests/system_tests_drain.py
+++ b/tests/system_tests_drain.py
@@ -31,6 +31,7 @@
 from proton.reactor import Container
 from time import sleep
 
+
 class DrainSupportTest(TestCase):
 
     @classmethod
@@ -77,7 +78,7 @@
         cls.router = cls.tester.qdrouterd(name, config, wait=False)
         cls.address = cls.router.addresses[0]
 
-        sleep(4) # starting router with wait=True hangs. sleep for now
+        sleep(4)  # starting router with wait=True hangs. sleep for now
 
     def test_drain_support_1_all_messages(self):
         drain_support = DrainMessagesHandler(self.address)
diff --git a/tests/system_tests_drain_support.py b/tests/system_tests_drain_support.py
index 37756b4..9b3748a 100644
--- a/tests/system_tests_drain_support.py
+++ b/tests/system_tests_drain_support.py
@@ -230,6 +230,7 @@
     it works properly when the 'test-router' is handling the drain by itself
     and that it fails only on the link route.
     """
+
     def __init__(self, address, route_name):
         # prefetch is set to zero so that proton does not automatically issue 10 credits.
         super(DrainMessagesMoreHandler, self).__init__(prefetch=0)
@@ -246,16 +247,16 @@
         self.verbose_printing = False
 
     def show_state(self):
-        return str("send_phase:" + str(self.send_phase) 
-                   + ", sent_count:" + str(self.sent_count) 
-                   + ", recv_phase:" + str(self.recv_phase) 
-                   + ", receive_count:" + str(self.received_count) 
+        return str("send_phase:" + str(self.send_phase)
+                   + ", sent_count:" + str(self.sent_count)
+                   + ", recv_phase:" + str(self.recv_phase)
+                   + ", receive_count:" + str(self.received_count)
                    + ", receiver_credit:" + str(self.receiver.credit)
                    + ", sender_credit:" + str(self.sender.credit))
 
     def printme(self, str):
         if (self.verbose_printing):
-            print (str + " " + self.show_state())
+            print(str + " " + self.show_state())
 
     def timeout(self):
         self.error = "Timeout Expired: sent: %d rcvd: %d" % (self.sent_count, self.received_count)
@@ -279,7 +280,7 @@
         # The fact that the event.link.credit is 0 means that the receiver will not be receiving any more
         # messages. That along with 10 messages received indicates that the drain worked.
         if self.send_phase == 2 and self.received_count == 10 and event.link.credit == 0:
-            self.printme ("sender transitions to phase 3 - drain completed, send new flow now")
+            self.printme("sender transitions to phase 3 - drain completed, send new flow now")
             self.receiver.flow(10)
             self.send_phase = 3
 
@@ -287,7 +288,7 @@
            and event.link.state & Endpoint.LOCAL_ACTIVE \
            and event.link.state & Endpoint.REMOTE_ACTIVE :
             self.on_sendable(event)
-        self.printme (("sender " if event.link.is_sender else "receiver ") + "exit on_link_flow:")
+        self.printme(("sender " if event.link.is_sender else "receiver ") + "exit on_link_flow:")
 
     def on_sendable(self, event):
         if event.link.is_sender and self.send_phase == 1 and self.sent_count < 10:
@@ -296,7 +297,7 @@
             dlv.settle()
             self.sent_count += 1
             if self.sent_count == 10:
-                self.printme ("sender transitions to phase 2 - wait for drain to finish")
+                self.printme("sender transitions to phase 2 - wait for drain to finish")
                 self.send_phase = 2
         elif event.link.is_sender and self.send_phase == 3 and self.sent_count < 20:
             msg = Message(body="Hello World", properties={'seq': self.sent_count})
@@ -304,9 +305,9 @@
             dlv.settle()
             self.sent_count += 1
             if self.sent_count == 20:
-                self.printme ("sender transitions to phase 4 - done sending")
+                self.printme("sender transitions to phase 4 - done sending")
                 self.send_phase = 4
-        self.printme (("sender " if event.link.is_sender else "receiver ") + "exit on_sendable:")
+        self.printme(("sender " if event.link.is_sender else "receiver ") + "exit on_sendable:")
 
     def on_message(self, event):
         if event.receiver == self.receiver:
@@ -320,25 +321,25 @@
                 # that the sender is sending. The router will also send back a response flow frame with
                 # drain=True but I don't have any way of making sure that the response frame reached the
                 # receiver
-                self.printme ("receiver transitions to phase 2 - sending drain now")
+                self.printme("receiver transitions to phase 2 - sending drain now")
                 event.receiver.drain(20)
                 self.recv_phase = 2
             elif self.recv_phase == 2 and self.received_count == 10:
-                self.printme ("receiver transitions to phase 3")
+                self.printme("receiver transitions to phase 3")
                 self.recv_phase = 3
                 msg = Message(body="Hello World", properties={'seq': self.sent_count})
                 dlv = self.sender.send(msg)
                 dlv.settle()
                 self.sent_count += 1
             elif self.recv_phase == 3 and self.received_count == 20:
-                self.printme ("receiver transitions to phase 4 - test is completed successfully")
+                self.printme("receiver transitions to phase 4 - test is completed successfully")
                 self.recv_phase = 4
                 self.error = None
                 self.timer.cancel()
                 self.receiver.close()
                 self.sender.close()
                 self.conn.close()
-            self.printme ("exit on_message:")
+            self.printme("exit on_message:")
 
     def run(self):
         Container(self).run()
diff --git a/tests/system_tests_dynamic_terminus.py b/tests/system_tests_dynamic_terminus.py
index d9efa52..e8994de 100644
--- a/tests/system_tests_dynamic_terminus.py
+++ b/tests/system_tests_dynamic_terminus.py
@@ -39,7 +39,7 @@
         super(RouterTest, cls).setUpClass()
 
         def router(name, connection):
-            
+
             config = [
                 ('router', {'mode': 'interior', 'id': name}),
                 ('listener', {'port': cls.tester.get_port(), 'stripAnnotations': 'no'}),
@@ -48,22 +48,21 @@
                 ('address', {'prefix': 'multicast', 'distribution': 'multicast'}),
                 connection
             ]
-            
+
             config = Qdrouterd.Config(config)
 
             cls.routers.append(cls.tester.qdrouterd(name, config, wait=True))
 
         cls.routers = []
-        
+
         inter_router_port = cls.tester.get_port()
-        
+
         router('A', ('listener', {'role': 'inter-router', 'port': inter_router_port}))
         router('B', ('connector', {'name': 'connectorToA', 'role': 'inter-router', 'port': inter_router_port}))
 
         cls.routers[0].wait_router_connected('B')
         cls.routers[1].wait_router_connected('A')
 
-
     def test_01_dynamic_source_test(self):
         test = DynamicSourceTest(self.routers[0].addresses[0], self.routers[1].addresses[0])
         test.run()
@@ -107,7 +106,7 @@
 
     def timeout(self):
         self.error = "Timeout Expired: n_sent_1=%d n_sent_2=%d n_rcvd=%d n_accepted=%d" %\
-        (self.n_sent_1, self.n_sent_2, self.n_rcvd, self.n_accepted)
+            (self.n_sent_1, self.n_sent_2, self.n_rcvd, self.n_accepted)
         self.sender_1_conn.close()
         self.sender_2_conn.close()
         self.receiver_conn.close()
@@ -124,7 +123,7 @@
         self.sender_2 = event.container.create_sender(self.sender_2_conn)
 
     def send(self):
-        if self.address == None:
+        if self.address is None:
             return
 
         while self.sender_1.credit > 0 and self.n_sent_1 < self.count:
@@ -148,7 +147,7 @@
     def on_message(self, event):
         if event.receiver == self.receiver:
             self.n_rcvd += 1
-            
+
     def on_accepted(self, event):
         self.n_accepted += 1
         if self.n_accepted == self.count * 2:
@@ -188,7 +187,7 @@
 
     def timeout(self):
         self.error = "Timeout Expired: n_sent=%d n_rcvd=%d n_accepted=%d" %\
-        (self.n_sent, self.n_rcvd, self.n_accepted)
+            (self.n_sent, self.n_rcvd, self.n_accepted)
         self.sender_conn.close()
         self.receiver_conn.close()
 
@@ -217,7 +216,7 @@
     def on_message(self, event):
         if event.receiver == self.receiver:
             self.n_rcvd += 1
-            
+
     def on_accepted(self, event):
         self.n_accepted += 1
         if self.n_accepted == self.count:
diff --git a/tests/system_tests_edge_router.py b/tests/system_tests_edge_router.py
index 7a0f0b6..abca9a5 100644
--- a/tests/system_tests_edge_router.py
+++ b/tests/system_tests_edge_router.py
@@ -45,6 +45,7 @@
 from subprocess import PIPE, STDOUT
 import re
 
+
 class AddrTimer(object):
     def __init__(self, parent):
         self.parent = parent
@@ -106,8 +107,8 @@
         cls.routers[1].wait_router_connected('INT.A')
 
         # 1 means skip that test.
-        cls.skip = { 'test_01' : 0
-                   }
+        cls.skip = {'test_01' : 0
+                    }
 
     def __init__(self, test_method):
         TestCase.__init__(self, test_method)
@@ -126,9 +127,10 @@
         out = p.communicate()[0]
         assert p.returncode == 0, \
             "qdstat exit status %s, output:\n%s" % (p.returncode, out)
-        if regexp: assert re.search(regexp, out,
-                                    re.I), "Can't find '%s' in '%s'" % (
-        regexp, out)
+        if regexp:
+            assert re.search(regexp, out,
+                             re.I), "Can't find '%s' in '%s'" % (
+                regexp, out)
         return out
 
     def can_terminate(self):
@@ -177,8 +179,8 @@
         Then we kill the router with the active connection and make sure
         that the other connection is now the active one
         """
-        if self.skip [ 'test_01' ] :
-            self.skipTest ( "Test skipped during development." )
+        if self.skip['test_01'] :
+            self.skipTest("Test skipped during development.")
 
         success = False
         outs = self.run_qdstat(['--edge'],
@@ -210,7 +212,7 @@
             self.fail("Edhe router has two active connections to interior "
                       "routers. Should have only one")
 
-        if not conn_map_edge["INT.A"] and  not conn_map_edge["INT.B"]:
+        if not conn_map_edge["INT.A"] and not conn_map_edge["INT.B"]:
             self.fail("There are no active aconnections to interior routers")
 
         if conn_map_edge["INT.A"]:
@@ -289,85 +291,84 @@
         cls.routers[0].wait_router_connected('INT.B')
         cls.routers[1].wait_router_connected('INT.A')
 
-
-        cls.skip = { 'test_01' : 0,
-                     'test_02' : 0,
-                     'test_03' : 0,
-                     'test_04' : 0,
-                     'test_05' : 0,
-                     'test_06' : 0,
-                     'test_07' : 0,
-                     'test_08' : 0,
-                     'test_09' : 0,
-                     'test_10' : 0,
-                     'test_11' : 0,
-                     'test_12' : 0,
-                     'test_13' : 0,
-                     'test_14' : 0,
-                     'test_15' : 0,
-                     'test_16' : 0,
-                     'test_17' : 0,
-                     'test_18' : 0,
-                     'test_19' : 0,
-                     'test_20' : 0,
-                     'test_21' : 0,
-                     'test_22' : 0,
-                     'test_23' : 0,
-                     'test_24' : 0,
-                     'test_25' : 0,
-                     'test_26' : 0,
-                     'test_27' : 0,
-                     'test_28' : 0,
-                     'test_29' : 0,
-                     'test_30' : 0,
-                     'test_31' : 0,
-                     'test_32' : 0,
-                     'test_33' : 0,
-                     'test_34' : 0,
-                     'test_35' : 0,
-                     'test_36' : 0,
-                     'test_37' : 0,
-                     'test_38' : 0,
-                     'test_39' : 0,
-                     'test_40' : 0,
-                     'test_41' : 0,
-                     'test_42' : 0,
-                     'test_43':  0,
-                     'test_44':  0,
-                     'test_45':  0,
-                     'test_46':  0,
-                     'test_47':  0,
-                     'test_48':  0,
-                     'test_49':  0,
-                     'test_50':  0,
-                     'test_51':  0,
-                     'test_52':  0,
-                     'test_53':  0,
-                     'test_54':  0,
-                     'test_55':  0,
-                     'test_56':  0,
-                     'test_57':  0,
-                     'test_58':  0,
-                     'test_59':  0,
-                     'test_60':  0,
-                     'test_61':  0,
-                     'test_62':  0,
-                     'test_63':  0,
-                     'test_64':  0,
-                     'test_65':  0,
-                     'test_66':  0,
-                     'test_67':  0,
-                     'test_68':  0,
-                     'test_69':  0,
-                     'test_70':  0,
-                     'test_71':  0,
-                     'test_72':  0,
-                     'test_73':  0
-                   }
+        cls.skip = {'test_01' : 0,
+                    'test_02' : 0,
+                    'test_03' : 0,
+                    'test_04' : 0,
+                    'test_05' : 0,
+                    'test_06' : 0,
+                    'test_07' : 0,
+                    'test_08' : 0,
+                    'test_09' : 0,
+                    'test_10' : 0,
+                    'test_11' : 0,
+                    'test_12' : 0,
+                    'test_13' : 0,
+                    'test_14' : 0,
+                    'test_15' : 0,
+                    'test_16' : 0,
+                    'test_17' : 0,
+                    'test_18' : 0,
+                    'test_19' : 0,
+                    'test_20' : 0,
+                    'test_21' : 0,
+                    'test_22' : 0,
+                    'test_23' : 0,
+                    'test_24' : 0,
+                    'test_25' : 0,
+                    'test_26' : 0,
+                    'test_27' : 0,
+                    'test_28' : 0,
+                    'test_29' : 0,
+                    'test_30' : 0,
+                    'test_31' : 0,
+                    'test_32' : 0,
+                    'test_33' : 0,
+                    'test_34' : 0,
+                    'test_35' : 0,
+                    'test_36' : 0,
+                    'test_37' : 0,
+                    'test_38' : 0,
+                    'test_39' : 0,
+                    'test_40' : 0,
+                    'test_41' : 0,
+                    'test_42' : 0,
+                    'test_43':  0,
+                    'test_44':  0,
+                    'test_45':  0,
+                    'test_46':  0,
+                    'test_47':  0,
+                    'test_48':  0,
+                    'test_49':  0,
+                    'test_50':  0,
+                    'test_51':  0,
+                    'test_52':  0,
+                    'test_53':  0,
+                    'test_54':  0,
+                    'test_55':  0,
+                    'test_56':  0,
+                    'test_57':  0,
+                    'test_58':  0,
+                    'test_59':  0,
+                    'test_60':  0,
+                    'test_61':  0,
+                    'test_62':  0,
+                    'test_63':  0,
+                    'test_64':  0,
+                    'test_65':  0,
+                    'test_66':  0,
+                    'test_67':  0,
+                    'test_68':  0,
+                    'test_69':  0,
+                    'test_70':  0,
+                    'test_71':  0,
+                    'test_72':  0,
+                    'test_73':  0
+                    }
 
     def test_01_connectivity_INTA_EA1(self):
-        if self.skip [ 'test_01' ] :
-            self.skipTest ( "Test skipped during development." )
+        if self.skip['test_01'] :
+            self.skipTest("Test skipped during development.")
 
         test = ConnectivityTest(self.routers[0].addresses[0],
                                 self.routers[2].addresses[0],
@@ -376,8 +377,8 @@
         self.assertEqual(None, test.error)
 
     def test_02_connectivity_INTA_EA2(self):
-        if self.skip [ 'test_02' ] :
-            self.skipTest ( "Test skipped during development." )
+        if self.skip['test_02'] :
+            self.skipTest("Test skipped during development.")
 
         test = ConnectivityTest(self.routers[0].addresses[0],
                                 self.routers[3].addresses[0],
@@ -386,8 +387,8 @@
         self.assertEqual(None, test.error)
 
     def test_03_connectivity_INTB_EB1(self):
-        if self.skip [ 'test_03' ] :
-            self.skipTest ( "Test skipped during development." )
+        if self.skip['test_03'] :
+            self.skipTest("Test skipped during development.")
 
         test = ConnectivityTest(self.routers[1].addresses[0],
                                 self.routers[4].addresses[0],
@@ -396,8 +397,8 @@
         self.assertEqual(None, test.error)
 
     def test_04_connectivity_INTB_EB2(self):
-        if self.skip [ 'test_04' ] :
-            self.skipTest ( "Test skipped during development." )
+        if self.skip['test_04'] :
+            self.skipTest("Test skipped during development.")
 
         test = ConnectivityTest(self.routers[1].addresses[0],
                                 self.routers[5].addresses[0],
@@ -406,8 +407,8 @@
         self.assertEqual(None, test.error)
 
     def test_05_dynamic_address_same_edge(self):
-        if self.skip [ 'test_05' ] :
-            self.skipTest ( "Test skipped during development." )
+        if self.skip['test_05'] :
+            self.skipTest("Test skipped during development.")
 
         test = DynamicAddressTest(self.routers[2].addresses[0],
                                   self.routers[2].addresses[0])
@@ -415,8 +416,8 @@
         self.assertEqual(None, test.error)
 
     def test_06_dynamic_address_interior_to_edge(self):
-        if self.skip [ 'test_06' ] :
-            self.skipTest ( "Test skipped during development." )
+        if self.skip['test_06'] :
+            self.skipTest("Test skipped during development.")
 
         test = DynamicAddressTest(self.routers[2].addresses[0],
                                   self.routers[0].addresses[0])
@@ -424,8 +425,8 @@
         self.assertEqual(None, test.error)
 
     def test_07_dynamic_address_edge_to_interior(self):
-        if self.skip [ 'test_07' ] :
-            self.skipTest ( "Test skipped during development." )
+        if self.skip['test_07'] :
+            self.skipTest("Test skipped during development.")
 
         test = DynamicAddressTest(self.routers[0].addresses[0],
                                   self.routers[2].addresses[0])
@@ -433,8 +434,8 @@
         self.assertEqual(None, test.error)
 
     def test_08_dynamic_address_edge_to_edge_one_interior(self):
-        if self.skip [ 'test_08' ] :
-            self.skipTest ( "Test skipped during development." )
+        if self.skip['test_08'] :
+            self.skipTest("Test skipped during development.")
 
         test = DynamicAddressTest(self.routers[2].addresses[0],
                                   self.routers[3].addresses[0])
@@ -442,8 +443,8 @@
         self.assertEqual(None, test.error)
 
     def test_09_dynamic_address_edge_to_edge_two_interior(self):
-        if self.skip [ 'test_09' ] :
-            self.skipTest ( "Test skipped during development." )
+        if self.skip['test_09'] :
+            self.skipTest("Test skipped during development.")
 
         test = DynamicAddressTest(self.routers[2].addresses[0],
                                   self.routers[4].addresses[0])
@@ -451,8 +452,8 @@
         self.assertEqual(None, test.error)
 
     def test_10_mobile_address_same_edge(self):
-        if self.skip [ 'test_10' ] :
-            self.skipTest ( "Test skipped during development." )
+        if self.skip['test_10'] :
+            self.skipTest("Test skipped during development.")
 
         test = MobileAddressTest(self.routers[2].addresses[0],
                                  self.routers[2].addresses[0],
@@ -461,8 +462,8 @@
         self.assertEqual(None, test.error)
 
     def test_11_mobile_address_interior_to_edge(self):
-        if self.skip [ 'test_11' ] :
-            self.skipTest ( "Test skipped during development." )
+        if self.skip['test_11'] :
+            self.skipTest("Test skipped during development.")
 
         test = MobileAddressTest(self.routers[2].addresses[0],
                                  self.routers[0].addresses[0],
@@ -471,8 +472,8 @@
         self.assertEqual(None, test.error)
 
     def test_12_mobile_address_edge_to_interior(self):
-        if self.skip [ 'test_12' ] :
-            self.skipTest ( "Test skipped during development." )
+        if self.skip['test_12'] :
+            self.skipTest("Test skipped during development.")
 
         test = MobileAddressTest(self.routers[0].addresses[0],
                                  self.routers[2].addresses[0],
@@ -483,8 +484,8 @@
         self.assertEqual(None, test.error)
 
     def test_13_mobile_address_edge_to_edge_one_interior(self):
-        if self.skip [ 'test_13' ] :
-            self.skipTest ( "Test skipped during development." )
+        if self.skip['test_13'] :
+            self.skipTest("Test skipped during development.")
 
         test = MobileAddressTest(self.routers[2].addresses[0],
                                  self.routers[3].addresses[0],
@@ -493,8 +494,8 @@
         self.assertEqual(None, test.error)
 
     def test_14_mobile_address_edge_to_edge_two_interior(self):
-        if self.skip [ 'test_14' ] :
-            self.skipTest ( "Test skipped during development." )
+        if self.skip['test_14'] :
+            self.skipTest("Test skipped during development.")
 
         test = MobileAddressTest(self.routers[2].addresses[0],
                                  self.routers[4].addresses[0],
@@ -505,8 +506,8 @@
     # One sender two receiver tests.
     # One sender and two receivers on the same edge
     def test_15_mobile_address_same_edge(self):
-        if self.skip [ 'test_15' ] :
-            self.skipTest ( "Test skipped during development." )
+        if self.skip['test_15'] :
+            self.skipTest("Test skipped during development.")
 
         test = MobileAddressOneSenderTwoReceiversTest(self.routers[2].addresses[0],
                                                       self.routers[2].addresses[0],
@@ -518,8 +519,8 @@
     # One sender and two receivers on the different edges. The edges are
     #  hanging off the  same interior router.
     def test_16_mobile_address_edge_to_another_edge_same_interior(self):
-        if self.skip [ 'test_16' ] :
-            self.skipTest ( "Test skipped during development." )
+        if self.skip['test_16'] :
+            self.skipTest("Test skipped during development.")
 
         test = MobileAddressOneSenderTwoReceiversTest(self.routers[2].addresses[0],
                                                       self.routers[2].addresses[0],
@@ -530,8 +531,8 @@
 
     # Two receivers on the interior and sender on the edge
     def test_17_mobile_address_edge_to_interior(self):
-        if self.skip [ 'test_17' ] :
-            self.skipTest ( "Test skipped during development." )
+        if self.skip['test_17'] :
+            self.skipTest("Test skipped during development.")
 
         test = MobileAddressOneSenderTwoReceiversTest(self.routers[0].addresses[0],
                                                       self.routers[0].addresses[0],
@@ -542,8 +543,8 @@
 
     # Two receivers on the edge and the sender on the interior
     def test_18_mobile_address_interior_to_edge(self):
-        if self.skip [ 'test_18' ] :
-            self.skipTest ( "Test skipped during development." )
+        if self.skip['test_18'] :
+            self.skipTest("Test skipped during development.")
 
         test = MobileAddressOneSenderTwoReceiversTest(self.routers[2].addresses[0],
                                                       self.routers[2].addresses[0],
@@ -554,8 +555,8 @@
 
     # Two receivers on the edge and the sender on the 'other' interior
     def test_19_mobile_address_other_interior_to_edge(self):
-        if self.skip [ 'test_19' ] :
-            self.skipTest ( "Test skipped during development." )
+        if self.skip['test_19'] :
+            self.skipTest("Test skipped during development.")
 
         test = MobileAddressOneSenderTwoReceiversTest(self.routers[2].addresses[0],
                                                       self.routers[2].addresses[0],
@@ -567,8 +568,8 @@
     # Two receivers on the edge and the sender on the edge of
     # the 'other' interior
     def test_20_mobile_address_edge_to_edge_two_interiors(self):
-        if self.skip [ 'test_20' ] :
-            self.skipTest ( "Test skipped during development." )
+        if self.skip['test_20'] :
+            self.skipTest("Test skipped during development.")
 
         test = MobileAddressOneSenderTwoReceiversTest(self.routers[2].addresses[0],
                                                       self.routers[2].addresses[0],
@@ -580,8 +581,8 @@
     # One receiver in an edge, another one in interior and the sender
     # is on the edge of another interior
     def test_21_mobile_address_edge_interior_receivers(self):
-        if self.skip [ 'test_21' ] :
-            self.skipTest ( "Test skipped during development." )
+        if self.skip['test_21'] :
+            self.skipTest("Test skipped during development.")
 
         test = MobileAddressOneSenderTwoReceiversTest(self.routers[4].addresses[0],
                                                       self.routers[1].addresses[0],
@@ -593,8 +594,8 @@
     # Two receivers one on each interior router and and an edge sender
     # connectoed to the first interior
     def test_22_mobile_address_edge_sender_two_interior_receivers(self):
-        if self.skip [ 'test_22' ] :
-            self.skipTest ( "Test skipped during development." )
+        if self.skip['test_22'] :
+            self.skipTest("Test skipped during development.")
 
         test = MobileAddressOneSenderTwoReceiversTest(self.routers[0].addresses[0],
                                                       self.routers[1].addresses[0],
@@ -604,8 +605,8 @@
         self.assertEqual(None, test.error)
 
     def test_23_mobile_address_edge_sender_two_edge_receivers(self):
-        if self.skip [ 'test_23' ] :
-            self.skipTest ( "Test skipped during development." )
+        if self.skip['test_23'] :
+            self.skipTest("Test skipped during development.")
 
         test = MobileAddressOneSenderTwoReceiversTest(self.routers[4].addresses[0],
                                                       self.routers[5].addresses[0],
@@ -616,8 +617,8 @@
 
     # 1 Sender and 3 receivers all on the same edge
     def test_24_multicast_mobile_address_same_edge(self):
-        if self.skip [ 'test_24' ] :
-            self.skipTest ( "Test skipped during development." )
+        if self.skip['test_24'] :
+            self.skipTest("Test skipped during development.")
 
         test = MobileAddressMulticastTest(self.routers[2].addresses[0],
                                           self.routers[2].addresses[0],
@@ -632,8 +633,8 @@
     # 1 Sender and receiver on one edge and 2 receivers on another edge
     # all in the same  interior
     def test_25_multicast_mobile_address_different_edges_same_interior(self):
-        if self.skip [ 'test_25' ] :
-            self.skipTest ( "Test skipped during development." )
+        if self.skip['test_25'] :
+            self.skipTest("Test skipped during development.")
 
         test = MobileAddressMulticastTest(self.routers[2].addresses[0],
                                           self.routers[2].addresses[0],
@@ -648,8 +649,8 @@
     # Two receivers on each edge, one receiver on interior and sender
     # on the edge
     def test_26_multicast_mobile_address_edge_to_interior(self):
-        if self.skip [ 'test_26' ] :
-            self.skipTest ( "Test skipped during development." )
+        if self.skip['test_26'] :
+            self.skipTest("Test skipped during development.")
 
         test = MobileAddressMulticastTest(self.routers[2].addresses[0],
                                           self.routers[3].addresses[0],
@@ -663,8 +664,8 @@
 
     # Receivers on the edge and sender on the interior
     def test_27_multicast_mobile_address_interior_to_edge(self):
-        if self.skip [ 'test_27' ] :
-            self.skipTest ( "Test skipped during development." )
+        if self.skip['test_27'] :
+            self.skipTest("Test skipped during development.")
 
         test = MobileAddressMulticastTest(self.routers[2].addresses[0],
                                           self.routers[2].addresses[0],
@@ -679,8 +680,8 @@
     # Receivers on the edge and sender on an interior that is not connected
     # to the edges.
     def test_28_multicast_mobile_address_other_interior_to_edge(self):
-        if self.skip [ 'test_28' ] :
-            self.skipTest ( "Test skipped during development." )
+        if self.skip['test_28'] :
+            self.skipTest("Test skipped during development.")
 
         test = MobileAddressMulticastTest(self.routers[2].addresses[0],
                                           self.routers[2].addresses[0],
@@ -694,8 +695,8 @@
 
     # Sender on an interior and 3 receivers connected to three different edges
     def test_29_multicast_mobile_address_edge_to_edge_two_interiors(self):
-        if self.skip [ 'test_29' ] :
-            self.skipTest ( "Test skipped during development." )
+        if self.skip['test_29'] :
+            self.skipTest("Test skipped during development.")
 
         test = MobileAddressMulticastTest(self.routers[2].addresses[0],
                                           self.routers[3].addresses[0],
@@ -708,8 +709,8 @@
         self.assertEqual(None, test.error)
 
     def test_30_multicast_mobile_address_all_edges(self):
-        if self.skip [ 'test_30' ] :
-            self.skipTest ( "Test skipped during development." )
+        if self.skip['test_30'] :
+            self.skipTest("Test skipped during development.")
 
         test = MobileAddressMulticastTest(self.routers[2].addresses[0],
                                           self.routers[3].addresses[0],
@@ -721,14 +722,13 @@
         test.run()
         self.assertEqual(None, test.error)
 
-
-
     ######### Multicast Large message tests ######################
 
     # 1 Sender and 3 receivers all on the same edge
+
     def test_31_multicast_mobile_address_same_edge(self):
-        if self.skip [ 'test_31' ] :
-            self.skipTest ( "Test skipped during development." )
+        if self.skip['test_31'] :
+            self.skipTest("Test skipped during development.")
 
         test = MobileAddressMulticastTest(self.routers[2].addresses[0],
                                           self.routers[2].addresses[0],
@@ -744,8 +744,8 @@
     # 1 Sender on one edge and 3 receivers on another edge all in the same
     # interior
     def test_32_multicast_mobile_address_different_edges_same_interior(self):
-        if self.skip [ 'test_32' ] :
-            self.skipTest ( "Test skipped during development." )
+        if self.skip['test_32'] :
+            self.skipTest("Test skipped during development.")
 
         test = MobileAddressMulticastTest(self.routers[2].addresses[0],
                                           self.routers[2].addresses[0],
@@ -761,8 +761,8 @@
     # Two receivers on each edge, one receiver on interior and sender
     # on the edge
     def test_33_multicast_mobile_address_edge_to_interior(self):
-        if self.skip [ 'test_33' ] :
-            self.skipTest ( "Test skipped during development." )
+        if self.skip['test_33'] :
+            self.skipTest("Test skipped during development.")
 
         test = MobileAddressMulticastTest(self.routers[2].addresses[0],
                                           self.routers[3].addresses[0],
@@ -777,8 +777,8 @@
 
     # Receivers on the edge and sender on the interior
     def test_34_multicast_mobile_address_interior_to_edge(self):
-        if self.skip [ 'test_34' ] :
-            self.skipTest ( "Test skipped during development." )
+        if self.skip['test_34'] :
+            self.skipTest("Test skipped during development.")
 
         test = MobileAddressMulticastTest(self.routers[2].addresses[0],
                                           self.routers[2].addresses[0],
@@ -794,8 +794,8 @@
     # Receivers on the edge and sender on an interior that is not connected
     # to the edges.
     def test_35_multicast_mobile_address_other_interior_to_edge(self):
-        if self.skip [ 'test_35' ] :
-            self.skipTest ( "Test skipped during development." )
+        if self.skip['test_35'] :
+            self.skipTest("Test skipped during development.")
 
         test = MobileAddressMulticastTest(self.routers[2].addresses[0],
                                           self.routers[2].addresses[0],
@@ -810,8 +810,8 @@
 
     # Sender on an interior and 3 receivers connected to three different edges
     def test_36_multicast_mobile_address_edge_to_edge_two_interiors(self):
-        if self.skip [ 'test_36' ] :
-            self.skipTest ( "Test skipped during development." )
+        if self.skip['test_36'] :
+            self.skipTest("Test skipped during development.")
 
         test = MobileAddressMulticastTest(self.routers[2].addresses[0],
                                           self.routers[3].addresses[0],
@@ -825,8 +825,8 @@
         self.assertEqual(None, test.error)
 
     def test_37_multicast_mobile_address_all_edges(self):
-        if self.skip [ 'test_37' ] :
-            self.skipTest ( "Test skipped during development." )
+        if self.skip['test_37'] :
+            self.skipTest("Test skipped during development.")
 
         test = MobileAddressMulticastTest(self.routers[2].addresses[0],
                                           self.routers[3].addresses[0],
@@ -840,8 +840,8 @@
         self.assertEqual(None, test.error)
 
     def test_38_mobile_addr_event_three_receivers_same_interior(self):
-        if self.skip [ 'test_38' ] :
-            self.skipTest ( "Test skipped during development." )
+        if self.skip['test_38'] :
+            self.skipTest("Test skipped during development.")
 
         test = MobileAddressEventTest(self.routers[2].addresses[0],
                                       self.routers[3].addresses[0],
@@ -854,8 +854,8 @@
         self.assertEqual(None, test.error)
 
     def test_39_mobile_addr_event_three_receivers_diff_interior(self):
-        if self.skip [ 'test_39' ] :
-            self.skipTest ( "Test skipped during development." )
+        if self.skip['test_39'] :
+            self.skipTest("Test skipped during development.")
 
         # This will test the QDRC_EVENT_ADDR_TWO_DEST event
         test = MobileAddressEventTest(self.routers[2].addresses[0],
@@ -869,8 +869,8 @@
         self.assertEqual(None, test.error)
 
     def test_40_drop_rx_client_multicast_large_message(self):
-        if self.skip [ 'test_40' ] :
-            self.skipTest ( "Test skipped during development." )
+        if self.skip['test_40'] :
+            self.skipTest("Test skipped during development.")
 
         # test what happens if some multicast receivers close in the middle of
         # a multiframe transfer
@@ -883,8 +883,8 @@
         self.assertEqual(None, test.error)
 
     def test_41_drop_rx_client_multicast_small_message(self):
-        if self.skip [ 'test_41' ] :
-            self.skipTest ( "Test skipped during development." )
+        if self.skip['test_41'] :
+            self.skipTest("Test skipped during development.")
 
         # test what happens if some multicast receivers close in the middle of
         # a multiframe transfer
@@ -892,13 +892,13 @@
                                             self.routers[2].addresses[0],
                                             self.routers[2].addresses[0],
                                             self.routers[2].addresses[0],
-                                            "multicast.40",large_msg=False)
+                                            "multicast.40", large_msg=False)
         test.run()
         self.assertEqual(None, test.error)
 
     def test_42_anon_sender_mobile_address_same_edge(self):
-        if self.skip [ 'test_42' ] :
-            self.skipTest ( "Test skipped during development." )
+        if self.skip['test_42'] :
+            self.skipTest("Test skipped during development.")
 
         test = MobileAddressAnonymousTest(self.routers[2].addresses[0],
                                           self.routers[2].addresses[0],
@@ -907,8 +907,8 @@
         self.assertEqual(None, test.error)
 
     def test_43_anon_sender_mobile_address_interior_to_edge(self):
-        if self.skip [ 'test_43' ] :
-            self.skipTest ( "Test skipped during development." )
+        if self.skip['test_43'] :
+            self.skipTest("Test skipped during development.")
 
         test = MobileAddressAnonymousTest(self.routers[2].addresses[0],
                                           self.routers[0].addresses[0],
@@ -917,8 +917,8 @@
         self.assertEqual(None, test.error)
 
     def test_44_anon_sender_mobile_address_edge_to_interior(self):
-        if self.skip [ 'test_44' ] :
-            self.skipTest ( "Test skipped during development." )
+        if self.skip['test_44'] :
+            self.skipTest("Test skipped during development.")
 
         test = MobileAddressAnonymousTest(self.routers[0].addresses[0],
                                           self.routers[2].addresses[0],
@@ -927,8 +927,8 @@
         self.assertEqual(None, test.error)
 
     def test_45_anon_sender_mobile_address_edge_to_edge_one_interior(self):
-        if self.skip [ 'test_45' ] :
-            self.skipTest ( "Test skipped during development." )
+        if self.skip['test_45'] :
+            self.skipTest("Test skipped during development.")
 
         test = MobileAddressAnonymousTest(self.routers[2].addresses[0],
                                           self.routers[3].addresses[0],
@@ -937,8 +937,8 @@
         self.assertEqual(None, test.error)
 
     def test_46_anon_sender_mobile_address_edge_to_edge_two_interior(self):
-        if self.skip [ 'test_46' ] :
-            self.skipTest ( "Test skipped during development." )
+        if self.skip['test_46'] :
+            self.skipTest("Test skipped during development.")
 
         test = MobileAddressAnonymousTest(self.routers[2].addresses[0],
                                           self.routers[4].addresses[0],
@@ -947,8 +947,8 @@
         self.assertEqual(None, test.error)
 
     def test_47_anon_sender_mobile_address_large_msg_same_edge(self):
-        if self.skip [ 'test_47' ] :
-            self.skipTest ( "Test skipped during development." )
+        if self.skip['test_47'] :
+            self.skipTest("Test skipped during development.")
 
         test = MobileAddressAnonymousTest(self.routers[2].addresses[0],
                                           self.routers[2].addresses[0],
@@ -957,8 +957,8 @@
         self.assertEqual(None, test.error)
 
     def test_48_anon_sender_mobile_address_large_msg_interior_to_edge(self):
-        if self.skip [ 'test_48' ] :
-            self.skipTest ( "Test skipped during development." )
+        if self.skip['test_48'] :
+            self.skipTest("Test skipped during development.")
 
         test = MobileAddressAnonymousTest(self.routers[2].addresses[0],
                                           self.routers[0].addresses[0],
@@ -967,8 +967,8 @@
         self.assertEqual(None, test.error)
 
     def test_49_anon_sender_mobile_address_large_msg_edge_to_interior(self):
-        if self.skip [ 'test_49' ] :
-            self.skipTest ( "Test skipped during development." )
+        if self.skip['test_49'] :
+            self.skipTest("Test skipped during development.")
 
         test = MobileAddressAnonymousTest(self.routers[0].addresses[0],
                                           self.routers[2].addresses[0],
@@ -977,8 +977,8 @@
         self.assertEqual(None, test.error)
 
     def test_50_anon_sender_mobile_address_large_msg_edge_to_edge_one_interior(self):
-        if self.skip [ 'test_50' ] :
-            self.skipTest ( "Test skipped during development." )
+        if self.skip['test_50'] :
+            self.skipTest("Test skipped during development.")
 
         test = MobileAddressAnonymousTest(self.routers[2].addresses[0],
                                           self.routers[3].addresses[0],
@@ -987,8 +987,8 @@
         self.assertEqual(None, test.error)
 
     def test_51_anon_sender_mobile_address_large_msg_edge_to_edge_two_interior(self):
-        if self.skip [ 'test_51' ] :
-            self.skipTest ( "Test skipped during development." )
+        if self.skip['test_51'] :
+            self.skipTest("Test skipped during development.")
 
         test = MobileAddressAnonymousTest(self.routers[2].addresses[0],
                                           self.routers[4].addresses[0],
@@ -998,8 +998,8 @@
 
     # 1 Sender and 3 receivers all on the same edge
     def test_52_anon_sender_multicast_mobile_address_same_edge(self):
-        if self.skip [ 'test_52' ] :
-            self.skipTest ( "Test skipped during development." )
+        if self.skip['test_52'] :
+            self.skipTest("Test skipped during development.")
 
         test = MobileAddressMulticastTest(self.routers[2].addresses[0],
                                           self.routers[2].addresses[0],
@@ -1015,8 +1015,8 @@
     # 1 Sender and receiver on one edge and 2 receivers on another edge
     # all in the same  interior
     def test_53_anon_sender_multicast_mobile_address_different_edges_same_interior(self):
-        if self.skip [ 'test_53' ] :
-            self.skipTest ( "Test skipped during development." )
+        if self.skip['test_53'] :
+            self.skipTest("Test skipped during development.")
 
         test = MobileAddressMulticastTest(self.routers[2].addresses[0],
                                           self.routers[2].addresses[0],
@@ -1032,8 +1032,8 @@
     # Two receivers on each edge, one receiver on interior and sender
     # on the edge
     def test_54_anon_sender_multicast_mobile_address_edge_to_interior(self):
-        if self.skip [ 'test_54' ] :
-            self.skipTest ( "Test skipped during development." )
+        if self.skip['test_54'] :
+            self.skipTest("Test skipped during development.")
 
         test = MobileAddressMulticastTest(self.routers[2].addresses[0],
                                           self.routers[3].addresses[0],
@@ -1048,8 +1048,8 @@
 
     # Receivers on the edge and sender on the interior
     def test_55_anon_sender_multicast_mobile_address_interior_to_edge(self):
-        if self.skip [ 'test_55' ] :
-            self.skipTest ( "Test skipped during development." )
+        if self.skip['test_55'] :
+            self.skipTest("Test skipped during development.")
 
         test = MobileAddressMulticastTest(self.routers[2].addresses[0],
                                           self.routers[2].addresses[0],
@@ -1065,8 +1065,8 @@
     # Receivers on the edge and sender on an interior that is not connected
     # to the edges.
     def test_56_anon_sender_multicast_mobile_address_other_interior_to_edge(self):
-        if self.skip [ 'test_56' ] :
-            self.skipTest ( "Test skipped during development." )
+        if self.skip['test_56'] :
+            self.skipTest("Test skipped during development.")
 
         test = MobileAddressMulticastTest(self.routers[2].addresses[0],
                                           self.routers[2].addresses[0],
@@ -1081,8 +1081,8 @@
 
     # Sender on an interior and 3 receivers connected to three different edges
     def test_57_anon_sender_multicast_mobile_address_edge_to_edge_two_interiors(self):
-        if self.skip [ 'test_57' ] :
-            self.skipTest ( "Test skipped during development." )
+        if self.skip['test_57'] :
+            self.skipTest("Test skipped during development.")
 
         test = MobileAddressMulticastTest(self.routers[2].addresses[0],
                                           self.routers[3].addresses[0],
@@ -1096,8 +1096,8 @@
         self.assertEqual(None, test.error)
 
     def test_58_anon_sender_multicast_mobile_address_all_edges(self):
-        if self.skip [ 'test_58' ] :
-            self.skipTest ( "Test skipped during development." )
+        if self.skip['test_58'] :
+            self.skipTest("Test skipped during development.")
 
         test = MobileAddressMulticastTest(self.routers[2].addresses[0],
                                           self.routers[3].addresses[0],
@@ -1110,13 +1110,13 @@
         test.run()
         self.assertEqual(None, test.error)
 
-
     ######### Multicast Large message anon sender tests ####################
 
     # 1 Sender and 3 receivers all on the same edge
+
     def test_59_anon_sender__multicast_mobile_address_same_edge(self):
-        if self.skip [ 'test_59' ] :
-            self.skipTest ( "Test skipped during development." )
+        if self.skip['test_59'] :
+            self.skipTest("Test skipped during development.")
 
         test = MobileAddressMulticastTest(self.routers[2].addresses[0],
                                           self.routers[2].addresses[0],
@@ -1133,8 +1133,8 @@
     # 1 Sender on one edge and 3 receivers on another edge all in the same
     # interior
     def test_60_anon_sender_multicast_mobile_address_different_edges_same_interior(self):
-        if self.skip [ 'test_60' ] :
-            self.skipTest ( "Test skipped during development." )
+        if self.skip['test_60'] :
+            self.skipTest("Test skipped during development.")
 
         test = MobileAddressMulticastTest(self.routers[2].addresses[0],
                                           self.routers[2].addresses[0],
@@ -1151,8 +1151,8 @@
     # Two receivers on each edge, one receiver on interior and sender
     # on the edge
     def test_61_anon_sender_multicast_mobile_address_edge_to_interior(self):
-        if self.skip [ 'test_61' ] :
-            self.skipTest ( "Test skipped during development." )
+        if self.skip['test_61'] :
+            self.skipTest("Test skipped during development.")
 
         test = MobileAddressMulticastTest(self.routers[2].addresses[0],
                                           self.routers[3].addresses[0],
@@ -1168,8 +1168,8 @@
 
     # Receivers on the edge and sender on the interior
     def test_62_anon_sender_multicast_mobile_address_interior_to_edge(self):
-        if self.skip [ 'test_62' ] :
-            self.skipTest ( "Test skipped during development." )
+        if self.skip['test_62'] :
+            self.skipTest("Test skipped during development.")
 
         test = MobileAddressMulticastTest(self.routers[2].addresses[0],
                                           self.routers[2].addresses[0],
@@ -1186,8 +1186,8 @@
     # Receivers on the edge and sender on an interior that is not connected
     # to the edges.
     def test_63_anon_sender_multicast_mobile_address_other_interior_to_edge(self):
-        if self.skip [ 'test_63' ] :
-            self.skipTest ( "Test skipped during development." )
+        if self.skip['test_63'] :
+            self.skipTest("Test skipped during development.")
 
         test = MobileAddressMulticastTest(self.routers[2].addresses[0],
                                           self.routers[2].addresses[0],
@@ -1203,8 +1203,8 @@
 
     # Sender on an interior and 3 receivers connected to three different edges
     def test_64_anon_sender_multicast_mobile_address_edge_to_edge_two_interiors(self):
-        if self.skip [ 'test_64' ] :
-            self.skipTest ( "Test skipped during development." )
+        if self.skip['test_64'] :
+            self.skipTest("Test skipped during development.")
 
         test = MobileAddressMulticastTest(self.routers[2].addresses[0],
                                           self.routers[3].addresses[0],
@@ -1219,8 +1219,8 @@
         self.assertEqual(None, test.error)
 
     def test_65_anon_sender_multicast_mobile_address_all_edges(self):
-        if self.skip [ 'test_65' ] :
-            self.skipTest ( "Test skipped during development." )
+        if self.skip['test_65'] :
+            self.skipTest("Test skipped during development.")
 
         test = MobileAddressMulticastTest(self.routers[2].addresses[0],
                                           self.routers[3].addresses[0],
@@ -1234,12 +1234,11 @@
         test.run()
         self.assertEqual(None, test.error)
 
-
     def test_66_anon_sender_drop_rx_client_multicast_large_message(self):
         # test what happens if some multicast receivers close in the middle of
         # a multiframe transfer. The sender is an anonymous sender.
-        if self.skip [ 'test_66' ] :
-            self.skipTest ( "Test skipped during development." )
+        if self.skip['test_66'] :
+            self.skipTest("Test skipped during development.")
 
         test = MobileAddrMcastAnonSenderDroppedRxTest(self.routers[2].addresses[0],
                                                       self.routers[2].addresses[0],
@@ -1252,8 +1251,8 @@
     def test_67_drop_rx_client_multicast_small_message(self):
         # test what happens if some multicast receivers close in the middle of
         # a multiframe transfer. The sender is an anonymous sender.
-        if self.skip [ 'test_67' ] :
-            self.skipTest ( "Test skipped during development." )
+        if self.skip['test_67'] :
+            self.skipTest("Test skipped during development.")
 
         test = MobileAddrMcastAnonSenderDroppedRxTest(self.routers[2].addresses[0],
                                                       self.routers[2].addresses[0],
@@ -1267,7 +1266,7 @@
     def run_qdstat(self, args, regexp=None, address=None):
         if args:
             popen_arg = ['qdstat', '--bus', str(address or self.router.addresses[0]),
-                 '--timeout', str(TIMEOUT)] + args
+                         '--timeout', str(TIMEOUT)] + args
         else:
             popen_arg = ['qdstat', '--bus',
                          str(address or self.router.addresses[0]),
@@ -1275,14 +1274,15 @@
 
         p = self.popen(popen_arg,
                        name='qdstat-' + self.id(), stdout=PIPE, expect=None,
-            universal_newlines=True)
+                       universal_newlines=True)
 
         out = p.communicate()[0]
         assert p.returncode == 0, \
             "qdstat exit status %s, output:\n%s" % (p.returncode, out)
-        if regexp: assert re.search(regexp, out,
-                                    re.I), "Can't find '%s' in '%s'" % (
-        regexp, out)
+        if regexp:
+            assert re.search(regexp, out,
+                             re.I), "Can't find '%s' in '%s'" % (
+                regexp, out)
         return out
 
     def test_68_edge_qdstat_all_routers(self):
@@ -1374,7 +1374,7 @@
 
         # Gets all entity information of the interior router
         outs = self.run_qdstat(['--all-entities'],
-                       address=self.routers[0].addresses[0])
+                               address=self.routers[0].addresses[0])
         self.assertEqual(outs.count("Router Links"), 1)
         self.assertEqual(outs.count("Router Addresses"), 1)
         self.assertEqual(outs.count("AutoLinks"), 1)
@@ -1386,10 +1386,10 @@
         try:
             # You cannot combine --all-entities  with -c
             outs = self.run_qdstat(['-c', '--all-entities'],
-                               address=self.routers[0].addresses[0])
+                                   address=self.routers[0].addresses[0])
         except Exception as e:
             if "error: argument --all-entities: not allowed with argument -c/--connections" in str(e):
-                has_error=True
+                has_error = True
 
         self.assertTrue(has_error)
 
@@ -1399,7 +1399,7 @@
                                    address=self.routers[0].addresses[0])
         except Exception as e:
             if "error: argument --all-routers: not allowed with argument -r/--router" in str(e):
-                has_error=True
+                has_error = True
 
         self.assertTrue(has_error)
 
@@ -1578,6 +1578,7 @@
 
         self.assertTrue(int_a_inter_router_conn_found and eb1_conn_found and eb2_conn_found)
 
+
 class LinkRouteProxyTest(TestCase):
     """
     Test edge router's ability to proxy configured and connection-scoped link
@@ -1658,13 +1659,13 @@
         cls.CONN_LINK_ROUTE_TYPE = 'org.apache.qpid.dispatch.router.connection.linkRoute'
         cls.CONNECTOR_TYPE = 'org.apache.qpid.dispatch.connector'
 
-        cls.skip = { 'test_01' : 0,
-                     'test_02' : 0,
-                     'test_03' : 0,
-                     'test_50' : 0,
-                     'test_51' : 0,
-                     'test_52' : 0
-                   }
+        cls.skip = {'test_01' : 0,
+                    'test_02' : 0,
+                    'test_03' : 0,
+                    'test_50' : 0,
+                    'test_51' : 0,
+                    'test_52' : 0
+                    }
 
     def _get_address(self, router, address):
         """Lookup address in route table"""
@@ -1688,8 +1689,8 @@
         tr.stop()
 
     def test_01_immedate_detach_reattach(self):
-        if self.skip [ 'test_01' ] :
-            self.skipTest ( "Test skipped during development." )
+        if self.skip['test_01'] :
+            self.skipTest("Test skipped during development.")
 
         """
         Have a service for a link routed address abruptly detach
@@ -1718,7 +1719,7 @@
         rx = AsyncTestReceiver(self.EB1.listener, 'CfgLinkRoute1/foo',
                                wait=False, recover_link=True)
         ad.link_dropped.wait(timeout=TIMEOUT)
-        ad.join() # wait for thread exit
+        ad.join()  # wait for thread exit
 
         # wait until prefix addresses are removed
         self._wait_address_gone(self.INT_B, "CfgLinkRoute1")
@@ -1749,9 +1750,8 @@
         """
         Rapidly add and delete link routes at the edge
         """
-        if self.skip [ 'test_02' ] :
-            self.skipTest ( "Test skipped during development." )
-
+        if self.skip['test_02'] :
+            self.skipTest("Test skipped during development.")
 
         # activate the pre-configured link routes
         ea1_mgmt = self.EA1.management
@@ -1807,8 +1807,8 @@
         """
         What happens when the interior connection bounces?
         """
-        if self.skip [ 'test_03' ] :
-            self.skipTest ( "Test skipped during development." )
+        if self.skip['test_03'] :
+            self.skipTest("Test skipped during development.")
 
         config = Qdrouterd.Config([('router', {'mode': 'edge',
                                                'id': 'Edge1'}),
@@ -1863,8 +1863,8 @@
         Verify that the link topology that results from activating a link route
         and sending traffic is correct
         """
-        if self.skip [ 'test_50' ] :
-            self.skipTest ( "Test skipped during development." )
+        if self.skip['test_50'] :
+            self.skipTest("Test skipped during development.")
 
         fs = FakeService(self.EA1.route_container)
         self.INT_B.wait_address("CfgLinkRoute1", count=2)
@@ -1912,7 +1912,7 @@
             self.EB1.listener: [
                 ('in',  'INT.B',      'edge'),
                 ('out', bc_b.container.container_id, 'normal')]
-            }
+        }
         for router, expected_links in expect.items():
             self._validate_topology(router, expected_links,
                                     'CfgLinkRoute1/buhbye')
@@ -1929,8 +1929,8 @@
         Activate the configured link routes via a FakeService, verify proxies
         created by passing traffic from/to and interior router
         """
-        if self.skip [ 'test_51' ] :
-            self.skipTest ( "Test skipped during development." )
+        if self.skip['test_51'] :
+            self.skipTest("Test skipped during development.")
 
         a_type = 'org.apache.qpid.dispatch.router.address'
 
@@ -1972,17 +1972,17 @@
         configured some link routes.  Then have clients on the interior
         exchange messages via the fake service.
         """
-        if self.skip [ 'test_52' ] :
-            self.skipTest ( "Test skipped during development." )
+        if self.skip['test_52'] :
+            self.skipTest("Test skipped during development.")
 
         fs = ConnLinkRouteService(self.EA1.route_container,
                                   container_id="FakeService",
-                                  config = [("ConnLinkRoute1",
-                                             {"pattern": "Conn/*/One",
-                                              "direction": "out"}),
-                                            ("ConnLinkRoute2",
-                                             {"pattern": "Conn/*/One",
-                                              "direction": "in"})])
+                                  config=[("ConnLinkRoute1",
+                                           {"pattern": "Conn/*/One",
+                                            "direction": "out"}),
+                                          ("ConnLinkRoute2",
+                                           {"pattern": "Conn/*/One",
+                                            "direction": "in"})])
         self.assertEqual(2, len(fs.values))
 
         self.INT_B.wait_address("Conn/*/One", count=2)
@@ -2132,6 +2132,7 @@
     receiver and send 50 more messages. These 50 messages should be released
     or modified.
     """
+
     def __init__(self, receiver_host, sender_host, address, large_msg=False):
         super(MobileAddressAnonymousTest, self).__init__()
         self.receiver_host = receiver_host
@@ -2160,7 +2161,6 @@
             self.body = "0123456789101112131415" * 10000
             self.properties = {'big field': 'X' * 32000}
 
-
     def on_start(self, event):
         self.timer = event.reactor.schedule(TIMEOUT, TestTimeout(self))
         self.receiver_conn = event.container.connect(self.receiver_host)
@@ -2175,7 +2175,7 @@
     def timeout(self):
         if self.ready:
             self.error = "Timeout Expired - n_sent=%d n_accepted=%d n_modified=%d n_released=%d" % (
-            self.n_sent,  self.n_accepted, self.n_modified, self.n_released)
+                self.n_sent,  self.n_accepted, self.n_modified, self.n_released)
         else:
             self.error = "Did not get a settlement from the receiver. The test cannot be started until " \
                          "a settlement to a test message is received"
@@ -2251,6 +2251,7 @@
       send an extra batch of messages that should be released or modified.
     Success is when message disposition counts add up correctly.
     """
+
     def __init__(self, receiver_host, sender_host, address):
         super(MobileAddressTest, self).__init__()
         self.receiver_host = receiver_host
@@ -2278,8 +2279,8 @@
         self.error = title
         self.logger.log("MobileAddressTest result:ERROR: %s" % title)
         self.logger.log("address %s     " % self.address)
-        self.logger.log("n_sent       = %d. Expected total:%d normal=%d, extra=%d" % \
-            (self.n_sent, (self.normal_count + self.extra_count), self.normal_count, self.extra_count))
+        self.logger.log("n_sent       = %d. Expected total:%d normal=%d, extra=%d" %
+                        (self.n_sent, (self.normal_count + self.extra_count), self.normal_count, self.extra_count))
         self.logger.log("n_rcvd       = %d. Expected %d" % (self.n_rcvd,       self.normal_count))
         self.logger.log("n_accepted   = %d. Expected %d" % (self.n_accepted,   self.normal_count))
         self.logger.log("n_rel_or_mod = %d. Expected %d" % (self.n_rel_or_mod, self.extra_count))
@@ -2340,7 +2341,7 @@
                                 (rdisp, self.n_rel_or_mod, self.extra_count))
             else:
                 self.logger.log("on_settled sender: WARNING unexpected settlement: %s, n_accepted: %d, n_rel_or_mod: %d" %
-                    (rdisp, self.n_accepted, self.n_rel_or_mod))
+                                (rdisp, self.n_accepted, self.n_rel_or_mod))
                 self.warning = True
 
             if self.n_sent == self.normal_count and self.n_accepted == self.normal_count:
@@ -2557,7 +2558,7 @@
             self.sender = self.container.create_sender(self.sender_conn)
         else:
             self.sender = self.container.create_sender(self.sender_conn,
-                                                   self.address)
+                                                       self.address)
 
     def check_address(self):
         local_node = Node.connect(self.check_addr_host, timeout=TIMEOUT)
@@ -2662,6 +2663,7 @@
     def run(self):
         Container(self).run()
 
+
 class MobileAddrMcastDroppedRxTest(MobileAddressMulticastTest):
     # failure scenario - cause some receiving clients to close while a large
     # message is in transit
@@ -2752,6 +2754,7 @@
         self.n_released += 1
         self._check_done()
 
+
 class MobileAddressEventTest(MessagingHandler):
     def __init__(self, receiver1_host, receiver2_host, receiver3_host,
                  sender_host, interior_host, address, check_remote=False):
@@ -2900,7 +2903,7 @@
 
     def on_settled(self, event):
         if self.n_rcvd1 + self.n_rcvd2 + self.n_rcvd3 == self.count and \
-                self.n_rcvd2 !=0 and self.n_rcvd3 !=0:
+                self.n_rcvd2 != 0 and self.n_rcvd3 != 0:
             self.timer.cancel()
             self.receiver1_conn.close()
             self.receiver2_conn.close()
@@ -2913,6 +2916,7 @@
     def run(self):
         Container(self).run()
 
+
 class EdgeListenerSender(TestCase):
 
     inter_router_port = None
@@ -2944,7 +2948,7 @@
         addr = self.routers[0].addresses[0]
         blocking_connection = BlockingConnection(addr)
         blocking_sender = blocking_connection.create_sender(address="multicast")
-        self.assertTrue(blocking_sender!=None)
+        self.assertTrue(blocking_sender is not None)
 
 
 class StreamingMessageTest(TestCase):
@@ -3011,7 +3015,7 @@
                               'port': cls.tester.get_port()}),
                 ('connector', {'name': 'uplink', 'role': 'edge',
                                'port': cls.INTA_edge_port})
-               ])
+                ])
         cls.EA1 = cls.routers[2]
         cls.EA1.listener = cls.EA1.addresses[0]
 
@@ -3028,10 +3032,10 @@
                                'FakeBroker', 'direction': 'in'}),
                 ('linkRoute', {'pattern': 'MyLinkRoute.#', 'containerId':
                                'FakeBroker', 'direction': 'out'})
-               ])
+                ])
         cls.EB1 = cls.routers[3]
         cls.EB1.listener = cls.EB1.addresses[0]
-        cls.EB1.route_container = cls.EB1.connector_addresses[1];
+        cls.EB1.route_container = cls.EB1.connector_addresses[1]
 
         cls.INT_A.wait_router_connected('INT.B')
         cls.INT_B.wait_router_connected('INT.A')
@@ -3039,13 +3043,13 @@
 
         cls._container_index = 0
 
-        cls.skip = { 'test_01' : 0,
-                     'test_02' : 0,
-                     'test_03' : 0,
-                     'test_50' : 0,
-                     'test_51' : 0,
-                     'test_52' : 0
-                   }
+        cls.skip = {'test_01' : 0,
+                    'test_02' : 0,
+                    'test_03' : 0,
+                    'test_50' : 0,
+                    'test_51' : 0,
+                    'test_52' : 0
+                    }
 
     def _get_address(self, router, address):
         """Lookup address in route table"""
@@ -3281,7 +3285,7 @@
                                   address="closest/test-address",
                                   expect=self.SIG_TERM)
 
-        self.INT_A.wait_address("closest/test-address");
+        self.INT_A.wait_address("closest/test-address")
 
         clogger = self.spawn_clogger(self.EA1,
                                      count=1,
@@ -3441,5 +3445,5 @@
         self._wait_address_gone(self.INT_B,  "balanced/test-address")
 
 
-if __name__== '__main__':
+if __name__ == '__main__':
     unittest.main(main_module())
diff --git a/tests/system_tests_exchange_bindings.py b/tests/system_tests_exchange_bindings.py
index 4acba3e..79b4599 100644
--- a/tests/system_tests_exchange_bindings.py
+++ b/tests/system_tests_exchange_bindings.py
@@ -41,14 +41,15 @@
     """
     Tests the exchange/bindings of the dispatch router.
     """
+
     def _create_router(self, name, config):
 
         config = [
-            ('router',   {'mode': 'standalone', 'id': 'QDR.%s'%name}),
+            ('router',   {'mode': 'standalone', 'id': 'QDR.%s' % name}),
             ('listener', {'role': 'normal', 'host': '0.0.0.0',
                           'port': self.tester.get_port(),
-                          'saslMechanisms':'ANONYMOUS'})
-            ] + config
+                          'saslMechanisms': 'ANONYMOUS'})
+        ] + config
         return self.tester.qdrouterd(name, Qdrouterd.Config(config))
 
     def run_qdmanage(self, router, cmd, input=None, expect=Process.EXIT_OK):
@@ -67,7 +68,7 @@
     def _validate_entity(self, name, kind, entities, expected):
         for entity in entities:
             if "name" in entity and entity["name"] == name:
-                for k,v in expected.items():
+                for k, v in expected.items():
                     self.assertIn(k, entity)
                     self.assertEqual(v, entity[k])
                 return
@@ -183,7 +184,7 @@
         # binding deletion by id:
         bid = bindings[0]["identity"]
         self.run_qdmanage(router, "delete --type " + _BINDING_TYPE +
-                              " --identity %s" % bid)
+                          " --identity %s" % bid)
         _ = self.run_qdmanage(router, "query --type %s" % _BINDING_TYPE)
         bindings = ast.literal_eval(_)
         self.assertEqual(len(binding_config) - 1, len(bindings))
@@ -192,7 +193,7 @@
 
         # binding deletion by name:
         self.run_qdmanage(router, "delete --type " + _BINDING_TYPE +
-                              " --name b14")
+                          " --name b14")
         _ = self.run_qdmanage(router, "query --type %s" % _BINDING_TYPE)
         bindings = ast.literal_eval(_)
         self.assertEqual(len(binding_config) - 2, len(bindings))
@@ -201,7 +202,7 @@
 
         # exchange deletion by name:
         self.run_qdmanage(router, "delete --type " + _EXCHANGE_TYPE +
-                              " --name Exchange1")
+                          " --name Exchange1")
         _ = self.run_qdmanage(router, "query --type %s" % _EXCHANGE_TYPE)
         exchanges = ast.literal_eval(_)
         self.assertEqual(len(ex_config) - 1, len(exchanges))
@@ -263,7 +264,7 @@
 
         # delete exchange by identity:
         self.run_qdmanage(router, "delete --type " + _EXCHANGE_TYPE +
-                              " --identity %s" % exchanges[0]["identity"])
+                          " --identity %s" % exchanges[0]["identity"])
 
     def test_forwarding(self):
         """
@@ -470,7 +471,7 @@
             ('router',   {'mode': 'standalone', 'id': 'QDR.mcast'}),
             ('listener', {'role': 'normal', 'host': '0.0.0.0',
                           'port': self.tester.get_port(),
-                          'saslMechanisms':'ANONYMOUS'}),
+                          'saslMechanisms': 'ANONYMOUS'}),
             ('address', {'pattern': 'nextHop2/#', 'distribution': 'multicast'}),
             ('exchange', {'address':          'Address3',
                           'name':             'Exchange1',
@@ -517,10 +518,11 @@
         Verify that the exchange and bindings are visible to other routers in
         the network
         """
+
         def router(self, name, extra_config):
 
             config = [
-                ('router', {'mode': 'interior', 'id': 'QDR.%s'%name, 'allowUnsettledMulticast': 'yes'}),
+                ('router', {'mode': 'interior', 'id': 'QDR.%s' % name, 'allowUnsettledMulticast': 'yes'}),
                 ('listener', {'port': self.tester.get_port(), 'stripAnnotations': 'no'})
             ] + extra_config
 
@@ -562,7 +564,7 @@
                              'exchangeName':   'ExchangeA',
                              'bindingKey':     'a/#',
                              'nextHopAddress': 'NotSubscribed'})
-               ])
+                ])
 
         router(self, 'B',
                [('connector', {'name': 'connectorToA',
@@ -574,7 +576,7 @@
                              'distribution': 'balanced'}),
                 ('address', {'pattern': 'nextHop3/#',
                              'distribution': 'closest'})
-               ])
+                ])
 
         self.routers[0].wait_router_connected('QDR.B')
         self.routers[1].wait_router_connected('QDR.A')
@@ -612,7 +614,7 @@
         """
         Verify that multi-frame messages are forwarded properly
         """
-        MAX_FRAME=1024
+        MAX_FRAME = 1024
         config = [
             ('router', {'mode': 'interior', 'id': 'QDR.X',
                         'allowUnsettledMulticast': 'yes'}),
@@ -706,4 +708,3 @@
 
 if __name__ == '__main__':
     unittest.main(main_module())
-
diff --git a/tests/system_tests_failover_list.py b/tests/system_tests_failover_list.py
index e780b5c..d78ba23 100644
--- a/tests/system_tests_failover_list.py
+++ b/tests/system_tests_failover_list.py
@@ -60,13 +60,13 @@
         self.assertEqual(None, test.error)
 
     def test_02_single_failover_host(self):
-        test = FailoverTest(self.routers[0].addresses[1], 1, [{'network-host':'other-host', 'port':'25000'}])
+        test = FailoverTest(self.routers[0].addresses[1], 1, [{'network-host': 'other-host', 'port': '25000'}])
         test.run()
         self.assertEqual(None, test.error)
 
     def test_03_double_failover_host(self):
-        test = FailoverTest(self.routers[0].addresses[2], 2, \
-                            [{'network-host':'second-host', 'port':'25000'}, {'scheme': 'amqps', 'network-host':'third-host', 'port': '5671'}])
+        test = FailoverTest(self.routers[0].addresses[2], 2,
+                            [{'network-host': 'second-host', 'port': '25000'}, {'scheme': 'amqps', 'network-host': 'third-host', 'port': '5671'}])
         test.run()
         self.assertEqual(None, test.error)
 
@@ -97,7 +97,7 @@
             fol = None
 
         if self.count == 0:
-            if fol != None and fol != []:
+            if fol is not None and fol != []:
                 self.error = "Expected no failover-list, got: %r" % fol
 
         elif fol.__class__ != list:
diff --git a/tests/system_tests_fallback_dest.py b/tests/system_tests_fallback_dest.py
index d55d2ef..230b234 100644
--- a/tests/system_tests_fallback_dest.py
+++ b/tests/system_tests_fallback_dest.py
@@ -95,7 +95,6 @@
         cls.ROUTER_EB1_WP = cls.routers[4].addresses[1]
         cls.ROUTER_EB2_WP = cls.routers[5].addresses[1]
 
-
     def test_01_sender_first_primary_same_interior(self):
         test = SenderFirstTest(self.ROUTER_INTA,
                                self.ROUTER_INTA,
@@ -813,5 +812,5 @@
         Container(self).run()
 
 
-if __name__== '__main__':
+if __name__ == '__main__':
     unittest.main(main_module())
diff --git a/tests/system_tests_grpc.py b/tests/system_tests_grpc.py
index 382b71a..c61641a 100644
--- a/tests/system_tests_grpc.py
+++ b/tests/system_tests_grpc.py
@@ -17,7 +17,8 @@
 # under the License.
 #
 
-import os, sys
+import os
+import sys
 from time import sleep, ctime
 import system_test
 from system_test import TestCase, Qdrouterd, QdManager, Process, SkipIfNeeded, TIMEOUT
diff --git a/tests/system_tests_handle_failover.py.in b/tests/system_tests_handle_failover.py.in
index 7fc2951..d7ff770 100644
--- a/tests/system_tests_handle_failover.py.in
+++ b/tests/system_tests_handle_failover.py.in
@@ -24,7 +24,8 @@
 
 import os
 from threading import Timer
-import json, re
+import json
+import re
 from system_test import main_module, TIMEOUT
 from system_test import TestCase, Qdrouterd, Process, TIMEOUT
 from system_test import unittest
@@ -67,28 +68,28 @@
         # original connection goes down, check that the router is trying to make connections to the failover urls.
         #
         FailoverTest.router('B', [
-                        ('router', {'mode': 'interior', 'id': 'B'}),
-                        ('listener', {'host': '0.0.0.0', 'role': 'inter-router', 'port': cls.inter_router_port,
-                                      'failoverUrls': cls.failover_list}),
-                        ('listener', {'host': '0.0.0.0', 'role': 'normal', 'port': cls.tester.get_port()}),
-                        ]
-              )
+            ('router', {'mode': 'interior', 'id': 'B'}),
+            ('listener', {'host': '0.0.0.0', 'role': 'inter-router', 'port': cls.inter_router_port,
+                          'failoverUrls': cls.failover_list}),
+            ('listener', {'host': '0.0.0.0', 'role': 'normal', 'port': cls.tester.get_port()}),
+        ]
+        )
 
         FailoverTest.router('A',
-                    [
-                        ('router', {'mode': 'interior', 'id': 'A'}),
-                        ('listener', {'host': '0.0.0.0', 'role': 'normal', 'port': cls.tester.get_port()}),
-                        ('connector', {'name': 'connectorToB', 'role': 'inter-router',
-                                       'port': cls.inter_router_port}),
-                    ]
-               )
+                            [
+                                ('router', {'mode': 'interior', 'id': 'A'}),
+                                ('listener', {'host': '0.0.0.0', 'role': 'normal', 'port': cls.tester.get_port()}),
+                                ('connector', {'name': 'connectorToB', 'role': 'inter-router',
+                                               'port': cls.inter_router_port}),
+                            ]
+                            )
 
         FailoverTest.router('C', [
                             ('router', {'mode': 'interior', 'id': 'C'}),
                             ('listener', {'host': '0.0.0.0', 'role': 'inter-router', 'port': cls.backup_port}),
                             ('listener', {'host': '0.0.0.0', 'role': 'normal', 'port': cls.tester.get_port()}),
-                        ]
-              )
+                            ]
+                            )
 
         cls.routers[1].wait_router_connected('B')
 
@@ -116,14 +117,15 @@
 
     def run_qdstat(self, args, regexp=None, address=None):
         p = self.popen(
-            ['qdstat', '--bus', str(address or self.router.addresses[0]), '--timeout', str(TIMEOUT) ] + args,
-            name='qdstat-'+self.id(), stdout=PIPE, expect=None,
+            ['qdstat', '--bus', str(address or self.router.addresses[0]), '--timeout', str(TIMEOUT)] + args,
+            name='qdstat-' + self.id(), stdout=PIPE, expect=None,
             universal_newlines=True)
 
         out = p.communicate()[0]
         assert p.returncode == 0, \
             "qdstat exit status %s, output:\n%s" % (p.returncode, out)
-        if regexp: assert re.search(regexp, out, re.I), "Can't find '%s' in '%s'" % (regexp, out)
+        if regexp:
+            assert re.search(regexp, out, re.I), "Can't find '%s' in '%s'" % (regexp, out)
         return out
 
     def test_1_connector_has_failover_list(self):
@@ -154,7 +156,7 @@
         output = json.loads(self.run_qdmanage(query_command, address=self.routers[1].addresses[0]))
 
         expected = FailoverTest.backup_url  + ", " + "amqp://127.0.0.1:" + str(FailoverTest.inter_router_port) \
-                   + ", " + "amqp://third-host:5671"
+            + ", " + "amqp://third-host:5671"
 
         if output[0].get('failoverUrls') == expected:
             self.success = True
@@ -196,7 +198,6 @@
 
         self.assertTrue(self.success)
 
-
     def schedule_C_to_B_failover_test(self):
         if self.attempts < self.max_attempts:
             if not self.success:
@@ -232,11 +233,11 @@
         but this test maskes sure that the new server url also shows up in the failoverUrls list.
         """
         FailoverTest.router('B', [
-                        ('router', {'mode': 'interior', 'id': 'B'}),
-                        ('listener', {'host': '0.0.0.0', 'role': 'inter-router', 'port': FailoverTest.inter_router_port,
-                                      'failoverUrls': FailoverTest.failover_list +  ', amqp://127.0.0.1:%d' % FailoverTest.my_server_port}),
-                        ('listener', {'host': '0.0.0.0', 'role': 'normal', 'port': FailoverTest.tester.get_port()}),
-                        ])
+            ('router', {'mode': 'interior', 'id': 'B'}),
+            ('listener', {'host': '0.0.0.0', 'role': 'inter-router', 'port': FailoverTest.inter_router_port,
+                          'failoverUrls': FailoverTest.failover_list +  ', amqp://127.0.0.1:%d' % FailoverTest.my_server_port}),
+            ('listener', {'host': '0.0.0.0', 'role': 'normal', 'port': FailoverTest.tester.get_port()}),
+        ])
 
         FailoverTest.routers[3].wait_ready()
 
@@ -285,7 +286,6 @@
         and the current connection info.
         """
 
-
         # Start MyServer
         proc = FailoverTest.tester.popen(
             ['/usr/bin/env', '${PY_STRING}', os.path.join(os.path.dirname(os.path.abspath(__file__)), 'failoverserver.py'), '-a',
diff --git a/tests/system_tests_http.py.in b/tests/system_tests_http.py.in
index e52fcee..6c7974b 100644
--- a/tests/system_tests_http.py.in
+++ b/tests/system_tests_http.py.in
@@ -97,7 +97,7 @@
         config = Qdrouterd.Config([
             ('router', {'mode': 'standalone', 'id': 'bad'}),
             ('listener', {'port': listen_port, 'maxFrameSize': '2048', 'stripAnnotations': 'no'}),
-            ('listener', {'port': listen_port, 'http':True})])
+            ('listener', {'port': listen_port, 'http': True})])
         r = Qdrouterd(name="expect_fail", config=config, wait=False)
         self.assertEqual(1, r.wait())
 
@@ -189,7 +189,8 @@
             self.assertRaises(HTTPError, urlopen, "http://localhost:%d/nosuch" % port)
 
         # Sequential calls on multiple ports
-        for port in r.ports: test(port)
+        for port in r.ports:
+            test(port)
 
         # Concurrent calls on multiple ports
         class TestThread(threading.Thread):
@@ -197,13 +198,18 @@
                 threading.Thread.__init__(self)
                 self.port, self.ex = port, None
                 self.start()
+
             def run(self):
-                try: test(self.port)
-                except Exception as e: self.ex = e
+                try:
+                    test(self.port)
+                except Exception as e:
+                    self.ex = e
         threads = [TestThread(p) for p in r.ports + r.ports]
-        for t in threads: t.join()
         for t in threads:
-            if t.ex: raise t.ex
+            t.join()
+        for t in threads:
+            if t.ex:
+                raise t.ex
 
         # https not configured
         self.assertRaises(URLError, urlopen, "https://localhost:%d/nosuch" % r.ports[0])
@@ -227,7 +233,8 @@
             assert('deliveries_redirected_to_fallback' in data)
 
         # Sequential calls on multiple ports
-        for port in r.ports: test(port)
+        for port in r.ports:
+            test(port)
 
         # Concurrent calls on multiple ports
         class TestThread(threading.Thread):
@@ -235,13 +242,18 @@
                 threading.Thread.__init__(self)
                 self.port, self.ex = port, None
                 self.start()
+
             def run(self):
-                try: test(self.port)
-                except Exception as e: self.ex = e
+                try:
+                    test(self.port)
+                except Exception as e:
+                    self.ex = e
         threads = [TestThread(p) for p in r.ports + r.ports]
-        for t in threads: t.join()
         for t in threads:
-            if t.ex: raise t.ex
+            t.join()
+        for t in threads:
+            if t.ex:
+                raise t.ex
 
     def test_http_healthz(self):
         config = Qdrouterd.Config([
@@ -256,7 +268,8 @@
             self.assertEqual(200, result.getcode())
 
         # Sequential calls on multiple ports
-        for port in r.ports: test(port)
+        for port in r.ports:
+            test(port)
 
         # Concurrent calls on multiple ports
         class TestThread(threading.Thread):
@@ -264,13 +277,18 @@
                 threading.Thread.__init__(self)
                 self.port, self.ex = port, None
                 self.start()
+
             def run(self):
-                try: test(self.port)
-                except Exception as e: self.ex = e
+                try:
+                    test(self.port)
+                except Exception as e:
+                    self.ex = e
         threads = [TestThread(p) for p in r.ports + r.ports]
-        for t in threads: t.join()
         for t in threads:
-            if t.ex: raise t.ex
+            t.join()
+        for t in threads:
+            if t.ex:
+                raise t.ex
 
     def test_https_get(self):
         def http_listener(**kwargs):
@@ -292,7 +310,7 @@
                             'privateKeyFile': self.ssl_file('server-private-key.pem'),
                             'ciphers': 'ECDH+AESGCM:DH+AESGCM:ECDH+AES256:DH+AES256:ECDH+AES128:DH+AES:RSA+AESGCM:RSA+AES:!aNULL:!MD5:!DSS',
                             'password': 'server-password'
-            }),
+                            }),
             http_listener(sslProfile='simple-ssl', requireSsl=False, authenticatePeer=False),
             http_listener(sslProfile='simple-ssl', requireSsl=True, authenticatePeer=False),
             http_listener(sslProfile='simple-ssl', requireSsl=True, authenticatePeer=True),
diff --git a/tests/system_tests_http1_adaptor.py b/tests/system_tests_http1_adaptor.py
index 9e6776a..439bc0c 100644
--- a/tests/system_tests_http1_adaptor.py
+++ b/tests/system_tests_http1_adaptor.py
@@ -55,6 +55,7 @@
     A 'hardcoded' HTTP request message.  This class writes its request
     message to the HTTPConnection.
     """
+
     def __init__(self, method, target, headers=None, body=None):
         self.method = method
         self.target = target
@@ -78,6 +79,7 @@
     A 'hardcoded' HTTP response message.  This class writes its response
     message when called by the HTTPServer via the BaseHTTPRequestHandler
     """
+
     def __init__(self, status, version=None, reason=None,
                  headers=None, body=None, error=False):
         self.status = status
@@ -110,6 +112,7 @@
     """
     Validate a response as received by the HTTP client
     """
+
     def __init__(self, status=200, expect_headers=None, expect_body=None):
         if expect_headers is None:
             expect_headers = {}
@@ -208,7 +211,7 @@
                         body += data[:-2]
                     else:
                         self.rfile.readline()  # discard last \r\n
-                        break;
+                        break
                 return body
         return self.rfile.read()
 
@@ -224,6 +227,7 @@
     """
     Adds a switch to the HTTPServer to allow it to exit gracefully
     """
+
     def __init__(self, addr, handler_cls, testcases):
         self.system_tests = testcases
         self.request_count = 0
@@ -242,6 +246,7 @@
     """
     A HTTPServer running in a separate thread
     """
+
     def __init__(self, server_port, client_port, tests, handler_cls=None):
         self._logger = Logger(title="TestServer", print_to_console=False)
         self._client_port = client_port
@@ -290,6 +295,7 @@
     """
     An HTTP client running in a separate thread
     """
+
     def __init__(self, tests, port, repeat=1):
         self._id = uuid.uuid4().hex
         self._conn_addr = ("127.0.0.1:%s" % port)
@@ -392,13 +398,13 @@
 
         config = [
             ('router', {'mode': 'standalone',
-                            'id': 'HTTP1MgmtTest',
+                        'id': 'HTTP1MgmtTest',
                         'allowUnsettledMulticast': 'yes'}),
             ('listener', {'role': 'normal',
                           'port': cls.tester.get_port()}),
             ('address', {'prefix': 'closest',   'distribution': 'closest'}),
             ('address', {'prefix': 'multicast', 'distribution': 'multicast'}),
-            ]
+        ]
 
         config = Qdrouterd.Config(config)
         cls.router = cls.tester.qdrouterd('HTTP1MgmtTest', config, wait=True)
@@ -454,7 +460,7 @@
                 if "http/1.x" in item["protocol"]:
                     hconns += 1
             if hconns == 0:
-                break;
+                break
             sleep(0.25)
             retry -= 1
 
@@ -608,7 +614,7 @@
              ResponseValidator(expect_headers={"App-Header-1": "Value 01",
                                                "Content-Length": "10",
                                                "App-Header-2": "Value 02"})
-            ),
+             ),
             (RequestMsg("HEAD", "/HEAD/test_02",
                         headers={"Content-Length": "0"}),
              ResponseMsg(200, headers={"App-Header-1": "Value 01",
@@ -642,7 +648,7 @@
                          + b'000\r\n'
                          + b'\r\n'),
              ResponseValidator(expect_body=b'12345678abcdefghijklmno')
-            ),
+             ),
             (RequestMsg("POST", "/POST/test_02",
                         headers={"App-Header-1": "Value 01",
                                  "Transfer-Encoding": "chunked"},
@@ -654,7 +660,7 @@
                                   "Content-Length": "9"},
                          body=b'Hi There!'),
              ResponseValidator(expect_body=b'Hi There!')
-            ),
+             ),
         ],
         #
         # PUT
@@ -672,7 +678,7 @@
                                   "Content-length": "3"},
                          body=b'ABC'),
              ResponseValidator(status=201, expect_body=b'ABC')
-            ),
+             ),
 
             (RequestMsg("PUT", "/PUT/test_02",
                         headers={"Put-Header-1": "Value 01",
@@ -683,7 +689,7 @@
                                   "Transfer-Encoding": "chunked"},
                          body=b'1\r\n$\r\n0\r\n\r\n'),
              ResponseValidator(status=201, expect_body=b'$')
-            ),
+             ),
         ]
     }
 
@@ -774,7 +780,7 @@
              ResponseValidator(expect_headers={"App-Header-1": "Value 01",
                                                "Content-Length": "10",
                                                "App-Header-2": "Value 02"})
-            ),
+             ),
 
             (RequestMsg("HEAD", "/HEAD/test_03",
                         headers={"Content-Length": "0"}),
@@ -794,7 +800,7 @@
                          headers={"Response-Header": "whatever"},
                          body=b'12345678abcdefghijklmno'),
              ResponseValidator(expect_body=b'12345678abcdefghijklmno')
-            ),
+             ),
             (RequestMsg("POST", "/POST/test_02",
                         headers={"App-Header-1": "Value 01",
                                  "Content-Length": "5"},
@@ -804,7 +810,7 @@
                                   "Content-Length": "9"},
                          body=b'Hi There!'),
              ResponseValidator(expect_body=b'Hi There!')
-            ),
+             ),
         ],
         #
         # PUT
@@ -820,7 +826,7 @@
                                   "Content-length": "3"},
                          body=b'ABC'),
              ResponseValidator(status=201, expect_body=b'ABC')
-            ),
+             ),
 
             (RequestMsg("PUT", "/PUT/test_02",
                         headers={"Put-Header-1": "Value 01",
@@ -830,11 +836,10 @@
                          headers={"Response-Header": "whatever"},
                          body=b'No Content Length'),
              ResponseValidator(status=201, expect_body=b'No Content Length')
-            ),
+             ),
         ]
     }
 
-
     @classmethod
     def setUpClass(cls):
         """Start a router"""
@@ -887,7 +892,7 @@
                 ('httpListener', {'port': cls.http_listener10_port,
                                   'protocolVersion': 'HTTP1',
                                   'address': 'testServer10'})
-               ])
+                ])
 
         cls.INT_A = cls.routers[0]
         cls.INT_A.listener = cls.INT_A.addresses[0]
@@ -984,6 +989,7 @@
             self.assertEqual(s.get('details').get('GET:200'), 6)
             self.assertEqual(s.get('details').get('GET:204'), 1)
             self.assertEqual(s.get('details').get('POST:200'), 2)
+
         def assert_approximately_equal(a, b):
             self.assertTrue((abs(a - b) / a) < 0.1)
         if stats[0].get('direction') == 'out':
@@ -1051,7 +1057,7 @@
         router('INT.A', 'interior',
                [('listener', {'role': 'edge', 'port': cls.INTA_edge1_port}),
                 ('listener', {'role': 'edge', 'port': cls.INTA_edge2_port}),
-               ])
+                ])
         cls.INT_A = cls.routers[0]
         cls.INT_A.listener = cls.INT_A.addresses[0]
 
@@ -1064,7 +1070,7 @@
                 ('httpListener', {'port': cls.http_listener10_port,
                                   'protocolVersion': 'HTTP1',
                                   'address': 'testServer10'})
-               ])
+                ])
         cls.EA1 = cls.routers[1]
         cls.EA1.listener = cls.EA1.addresses[0]
 
@@ -1077,7 +1083,7 @@
                 ('httpConnector', {'port': cls.http_server10_port,
                                    'protocolVersion': 'HTTP1',
                                    'address': 'testServer10'})
-               ])
+                ])
         cls.EA2 = cls.routers[-1]
         cls.EA2.listener = cls.EA2.addresses[0]
 
@@ -1107,7 +1113,7 @@
                              headers={"Test-Header": "/PUT/test_01_concurrent_requests_11",
                                       "Content-Length": "0"}),
                  ResponseValidator(status=201)
-                )],
+                 )],
 
             "GET": [
                 (RequestMsg("GET", "/GET/test_01_concurrent_requests_11_small",
@@ -1136,7 +1142,7 @@
                              + b'13\r\nEND OF TRANSMISSION\r\n'
                              + b'0\r\n\r\n'),
                  ResponseValidator(status=200)
-                )],
+                 )],
         }
 
         TESTS_10 = {
@@ -1150,7 +1156,7 @@
                              headers={"Test-Header": "/POST/test_01_concurrent_requests_10",
                                       "Content-Length": "0"}),
                  ResponseValidator(status=201)
-                )],
+                 )],
 
             "GET": [
                 (RequestMsg("GET", "/GET/test_01_concurrent_requests_10_small",
@@ -1171,7 +1177,7 @@
                              body=b'G' * 393196
                              + b'END OF TRANSMISSION'),
                  ResponseValidator(status=200)
-                )],
+                 )],
         }
         server11 = TestServer(server_port=self.http_server11_port,
                               client_port=self.http_listener11_port,
@@ -1224,7 +1230,7 @@
                                       "Content-Type": "text/plain;charset=utf-8"},
                              body=b'test_02_credit_replenish'),
                  ResponseValidator(status=200),
-                ),
+                 ),
             ]
         }
         server = TestServer(server_port=self.http_server11_port,
@@ -1253,7 +1259,7 @@
                                       "Content-Type": "text/plain;charset=utf-8"},
                              body=b'test_03_server_reconnect'),
                  ResponseValidator(status=200),
-                ),
+                 ),
             ]
         }
 
@@ -1304,7 +1310,7 @@
                                       "Content-Type": "text/plain;charset=utf-8"},
                              body=b'test_04_fjord_pining'),
                  ResponseValidator(status=200),
-                ),
+                 ),
             ]
         }
 
@@ -1329,7 +1335,7 @@
                                       "Content-Type": "text/plain;charset=utf-8"},
                              body=b'test_04_fjord_pining'),
                  ResponseValidator(status=503),
-                ),
+                 ),
             ]
         }
 
@@ -1431,15 +1437,15 @@
                                       self.http_listener11_port,
                                       repeat=2)
         client11.wait()
-        self.assertIsNone(client11.error);
-        self.assertEqual(4, client11.count);
+        self.assertIsNone(client11.error)
+        self.assertEqual(4, client11.count)
 
         client10 = ThreadedTestClient(TESTS_10,
                                       self.http_listener10_port,
                                       repeat=2)
         client10.wait()
         self.assertIsNone(client10.error)
-        self.assertEqual(4, client10.count);
+        self.assertEqual(4, client10.count)
 
         server11.wait()
         server10.wait()
@@ -1449,6 +1455,7 @@
     """
     A very base socket server to simulate HTTP server behaviors
     """
+
     def __init__(self, host='', port=80, bufsize=1024):
         super(FakeHttpServerBase, self).__init__()
         self.host = host
@@ -1463,7 +1470,8 @@
         self.do_connect()
         while True:
             data = self.conn.recv(bufsize)
-            if not data: break
+            if not data:
+                break
             self.do_data(data)
         self.do_close()
 
@@ -1566,7 +1574,7 @@
                              target="testServer",
                              message=msg)
         ts.wait()
-        self.assertEqual(1, ts.rejected);
+        self.assertEqual(1, ts.rejected)
 
         msg = Message(body="NO REPLY TO " + body_filler)
         msg.id = 1
@@ -1574,7 +1582,7 @@
                              target="testServer",
                              message=msg)
         ts.wait()
-        self.assertEqual(1, ts.rejected);
+        self.assertEqual(1, ts.rejected)
 
         msg = Message(body="NO SUBJECT " + body_filler)
         msg.id = 1
@@ -1583,7 +1591,7 @@
                              target="testServer",
                              message=msg)
         ts.wait()
-        self.assertEqual(1, ts.rejected);
+        self.assertEqual(1, ts.rejected)
 
         msg = Message(body="NO APP PROPERTIES " + body_filler)
         msg.id = 1
@@ -1593,7 +1601,7 @@
                              target="testServer",
                              message=msg)
         ts.wait()
-        self.assertEqual(1, ts.rejected);
+        self.assertEqual(1, ts.rejected)
 
         # TODO: fix body parsing (returns NEED_MORE)
         # msg = Message(body="INVALID BODY " + body_filler)
@@ -1625,7 +1633,7 @@
                             headers={"Content-Length": "000"}),
                  None,
                  None,
-                ),
+                 ),
             ]
         }
 
@@ -1645,7 +1653,7 @@
                              target=req.reply_to,
                              message=resp)
         ts.wait()
-        self.assertEqual(1, ts.rejected);
+        self.assertEqual(1, ts.rejected)
         client.wait()
         self.assertIsNotNone(client.error)
 
@@ -1661,7 +1669,7 @@
                              target=req.reply_to,
                              message=resp)
         ts.wait()
-        self.assertEqual(1, ts.rejected);
+        self.assertEqual(1, ts.rejected)
         client.wait()
         self.assertIsNotNone(client.error)
 
@@ -1677,7 +1685,7 @@
                              target=req.reply_to,
                              message=resp)
         ts.wait()
-        self.assertEqual(1, ts.rejected);
+        self.assertEqual(1, ts.rejected)
         client.wait()
         self.assertIsNotNone(client.error)
 
@@ -1708,7 +1716,6 @@
         self.assertEqual(1, count)
 
 
-
 class Http1AdaptorQ2Standalone(TestCase):
     """
     Force Q2 blocking/recovery on both client and server endpoints. This test
@@ -1745,7 +1752,6 @@
         cls.INT_A = cls.tester.qdrouterd("TestBadEndpoints", config, wait=True)
         cls.INT_A.listener = cls.INT_A.addresses[0]
 
-
     def _write_until_full(self, sock, data, timeout):
         """
         Write data to socket until either all data written or timeout.
diff --git a/tests/system_tests_http2.py b/tests/system_tests_http2.py
index 59a7a23..71577ba 100644
--- a/tests/system_tests_http2.py
+++ b/tests/system_tests_http2.py
@@ -17,7 +17,8 @@
 # under the License.
 #
 
-import os, sys
+import os
+import sys
 from time import sleep
 import system_test
 from system_test import TestCase, Qdrouterd, QdManager, Process, SkipIfNeeded
@@ -28,6 +29,7 @@
     if sys.version_info >= (3, 7):
         return True
 
+
 def curl_available():
     popen_args = ['curl', '--version']
     try:
@@ -41,6 +43,7 @@
     except:
         return False
 
+
 def quart_available():
     """
     Checks if quart version is greater than 0.13
@@ -59,15 +62,17 @@
             return True
         return False
     except Exception as e:
-        print (e)
+        print(e)
         print("quart_not_available")
         return False
 
+
 def skip_test():
     if python_37_available() and quart_available() and curl_available():
         return False
     return True
 
+
 class Http2TestBase(TestCase):
     def run_curl(self, args=None, regexp=None, timeout=system_test.TIMEOUT, address=None):
         # Tell with -m / --max-time the maximum time, in seconds, that you
@@ -116,8 +121,8 @@
             i += 1
         self.assertIn(ret_string, out)
 
-    #@SkipIfNeeded(skip_test(), "Python 3.7 or greater, Quart 0.13.0 or greater and curl needed to run http2 tests")
-    #def test_large_get_request(self):
+    # @SkipIfNeeded(skip_test(), "Python 3.7 or greater, Quart 0.13.0 or greater and curl needed to run http2 tests")
+    # def test_large_get_request(self):
         # Tests a large get request. Response is more than 50k which means it
         # will span many qd_http2_buffer_t objects.
         # Run curl 127.0.0.1:port/largeget --http2-prior-knowledge
@@ -139,7 +144,6 @@
         out = self.run_curl(args=['-X', 'DELETE'], address=address)
         self.assertIn('{"fname": "John", "lname": "Doe", "id": "22122"}', out)
 
-
     @SkipIfNeeded(skip_test(), "Python 3.7 or greater, Quart 0.13.0 or greater and curl needed to run http2 tests")
     def test_put_request(self):
         # curl -d "fname=John&lname=Doe" -X PUT 127.0.0.1:9000/myinfo --http2-prior-knowledge
@@ -188,7 +192,7 @@
             address = self.router_qdra.http_addresses[0] + "/images/apache.jpg"
             self.run_curl(address=address)
         except UnicodeDecodeError as u:
-            print (u)
+            print(u)
             if "codec can't decode byte 0xff" in str(u):
                 passed = True
         self.assertTrue(passed)
@@ -235,11 +239,11 @@
 
         sleep(2)
 
-        #Now, run a curl client GET request with a timeout
+        # Now, run a curl client GET request with a timeout
         request_timed_out = False
         try:
             out = self.run_curl(address=client_addr, timeout=5)
-            print (out)
+            print(out)
         except Exception as e:
             request_timed_out = True
 
@@ -268,6 +272,7 @@
             i += 1
         self.assertIn(ret_string, out)
 
+
 class Http2TestOneStandaloneRouter(Http2TestBase, CommonHttp2Tests):
     @classmethod
     def setUpClass(cls):
@@ -305,7 +310,6 @@
         self.check_connector_delete(client_addr=self.router_qdra.http_addresses[0],
                                     server_addr=self.router_qdra.addresses[0])
 
-
     @SkipIfNeeded(skip_test(), "Python 3.7 or greater, Quart 0.13.0 or greater and curl needed to run http2 tests")
     def test_000_stats(self):
         # Run curl 127.0.0.1:port --http2-prior-knowledge
@@ -351,6 +355,7 @@
             self.assertEqual(stats[1].get('bytesOut'), 24)
             self.assertEqual(stats[1].get('bytesIn'), 3944)
 
+
 class Http2TestOneEdgeRouter(Http2TestBase, CommonHttp2Tests):
     @classmethod
     def setUpClass(cls):
@@ -388,6 +393,7 @@
         self.check_connector_delete(client_addr=self.router_qdra.http_addresses[0],
                                     server_addr=self.router_qdra.addresses[0])
 
+
 class Http2TestOneInteriorRouter(Http2TestBase, CommonHttp2Tests):
     @classmethod
     def setUpClass(cls):
@@ -425,6 +431,7 @@
         self.check_connector_delete(client_addr=self.router_qdra.http_addresses[0],
                                     server_addr=self.router_qdra.addresses[0])
 
+
 class Http2TestTwoRouter(Http2TestBase, CommonHttp2Tests):
     @classmethod
     def setUpClass(cls):
@@ -529,6 +536,7 @@
         self.check_connector_delete(client_addr=self.router_qdra.http_addresses[0],
                                     server_addr=self.router_qdrb.addresses[0])
 
+
 class Http2TestEdgeInteriorRouter(Http2TestBase, CommonHttp2Tests):
     """
     The interior router connects to the HTTP2 server and the curl client
@@ -614,7 +622,6 @@
         sleep(3)
 
 
-
 class Http2TestEdgeToEdgeViaInteriorRouter(Http2TestBase, CommonHttp2Tests):
     """
     The edge router connects to the HTTP2 server and the curl client
@@ -671,7 +678,7 @@
         ])
 
         cls.interior_qdr = cls.tester.qdrouterd("interior-router", config_qdra,
-                                               wait=True)
+                                                wait=True)
         cls.router_qdra = cls.tester.qdrouterd("edge-router-a", config_edge_a)
         cls.router_qdrb = cls.tester.qdrouterd("edge-router-b", config_edge_b)
         sleep(5)
diff --git a/tests/system_tests_interior_sync_up.py b/tests/system_tests_interior_sync_up.py
index 5affefc..dd92528 100644
--- a/tests/system_tests_interior_sync_up.py
+++ b/tests/system_tests_interior_sync_up.py
@@ -78,7 +78,6 @@
         router('INT.B', 'interior',
                ('listener', {'role': 'inter-router', 'port': inter_router_port}))
 
-
     def test_interior_sync_up(self):
         test = InteriorSyncUpTest(self.routers[0].addresses[0], self.routers[1].addresses[0], self.routers[1].ports[1])
         test.run()
@@ -173,7 +172,7 @@
             self.probe_sender = self.container.create_sender(self.conn_a, '$management')
         elif event.sender == self.probe_sender:
             ##
-            ## Create listeners for an address per count
+            # Create listeners for an address per count
             ##
             self.add_receivers()
             self.last_action = "started slow creation of receivers"
@@ -186,7 +185,7 @@
 
     def on_message(self, event):
         if event.receiver == self.probe_receiver:
-            response = self.proxy.response(event.message);
+            response = self.proxy.response(event.message)
 
             if response.status_code < 200 or response.status_code > 299:
                 self.fail("Unexpected operation failure: (%d) %s" % (response.status_code, response.status_description))
@@ -198,7 +197,7 @@
                         self.fail("Found address on host-a when we didn't expect it - %s" % addr.name)
 
                 ##
-                ## Hook up the two routers to start the sync-up
+                # Hook up the two routers to start the sync-up
                 ##
                 self.probe_sender.send(self.proxy.create_connector("IR", port=self.inter_router_port, role="inter-router"))
                 self.expect      = "create-success"
@@ -206,7 +205,7 @@
 
             elif self.expect == "create-success":
                 ##
-                ## Start polling for the addresses on host_a
+                # Start polling for the addresses on host_a
                 ##
                 response  = self.proxy.response(event.message)
                 self.probe_sender.send(self.proxy.query_addresses())
@@ -226,12 +225,11 @@
                     self.fail(None)
                 else:
                     self.poll_timer = self.reactor.schedule(0.5, PollTimeout(self))
-                
 
     def run(self):
         container = Container(self)
         container.run()
 
 
-if __name__== '__main__':
+if __name__ == '__main__':
     unittest.main(main_module())
diff --git a/tests/system_tests_link_route_credit.py b/tests/system_tests_link_route_credit.py
index 432d586..b64e931 100644
--- a/tests/system_tests_link_route_credit.py
+++ b/tests/system_tests_link_route_credit.py
@@ -83,7 +83,6 @@
         cls.routers[0].wait_router_connected('INT.B')
         cls.routers[1].wait_router_connected('INT.A')
 
-
     def test_01_dest_sender_same_edge(self):
         test = LRDestSenderFlowTest(self.routers[2].addresses[0],
                                     self.routers[2].addresses[1],
@@ -430,7 +429,7 @@
 
     def on_message(self, event):
         if event.receiver == self.probe_receiver:
-            response = self.proxy.response(event.message);
+            response = self.proxy.response(event.message)
             self.last_action = "Handling probe response: remote: %d container: %d" \
                                % (response.remoteCount, response.containerCount)
             if response.status_code == 200 and response.remoteCount + response.containerCount == 1:
@@ -441,7 +440,6 @@
                 self.last_action = "opening test receiver"
             else:
                 self.poll_timer = self.reactor.schedule(0.5, PollTimeout(self))
-                
 
     def run(self):
         container = Container(self)
@@ -541,7 +539,7 @@
 
     def on_message(self, event):
         if event.receiver == self.probe_receiver:
-            response = self.proxy.response(event.message);
+            response = self.proxy.response(event.message)
             self.last_action = "Handling probe response: remote: %d container: %d" \
                                % (response.remoteCount, response.containerCount)
             if response.status_code == 200 and response.remoteCount + response.containerCount == 1:
@@ -549,7 +547,6 @@
                 self.last_action = "opening test sender"
             else:
                 self.poll_timer = self.reactor.schedule(0.5, PollTimeout(self))
-                
 
     def run(self):
         container = Container(self)
@@ -593,5 +590,5 @@
         container.run()
 
 
-if __name__== '__main__':
+if __name__ == '__main__':
     unittest.main(main_module())
diff --git a/tests/system_tests_link_routes.py b/tests/system_tests_link_routes.py
index 1334618..762b49a 100644
--- a/tests/system_tests_link_routes.py
+++ b/tests/system_tests_link_routes.py
@@ -86,7 +86,7 @@
         def router(name, connection):
 
             config = [
-                ('router', {'mode': 'interior', 'id': 'QDR.%s'%name}),
+                ('router', {'mode': 'interior', 'id': 'QDR.%s' % name}),
             ] + connection
 
             config = Qdrouterd.Config(config)
@@ -156,7 +156,7 @@
                    ('linkRoute', {'pattern': 'a.*.toD.#', 'direction': 'in'}),
                    ('linkRoute', {'pattern': 'a.*.toD.#', 'direction': 'out'})
 
-                ]
+               ]
                )
         router('D',  # sink for QDR.D routes
                [
@@ -174,12 +174,12 @@
         sleep(2)
 
     def run_qdstat_linkRoute(self, address, args=None):
-        cmd = ['qdstat', '--bus', str(address), '--timeout', str(TIMEOUT) ] + ['--linkroute']
+        cmd = ['qdstat', '--bus', str(address), '--timeout', str(TIMEOUT)] + ['--linkroute']
         if args:
             cmd = cmd + args
         p = self.popen(
             cmd,
-            name='qdstat-'+self.id(), stdout=PIPE, expect=None,
+            name='qdstat-' + self.id(), stdout=PIPE, expect=None,
             universal_newlines=True)
 
         out = p.communicate()[0]
@@ -262,7 +262,7 @@
 
         """
         out = self.run_qdstat_linkRoute(self.routers[1].addresses[0])
-        for route in ['a.*.toA.#', 'a.*.toD.#', 'org.apache',  'pulp.task']:
+        for route in ['a.*.toA.#', 'a.*.toD.#', 'org.apache', 'pulp.task']:
             self.assertIn(route, out)
 
         out_list = out.split()
@@ -480,7 +480,7 @@
                     raise Exception("Expected route '%s' to expire!" % route)
                 sleep(0.1)
             except NotFoundStatus:
-                break;
+                break
 
         node_A.close()
         node_B.close()
@@ -889,7 +889,7 @@
             # router so that the address Dpulp.task can show up on the remoteCount
             i = 0
             while continue_loop:
-                if i > 100: # If we have run the read command for more than hundred times and we still do not have
+                if i > 100:  # If we have run the read command for more than hundred times and we still do not have
                     # the remoteCount set to 1, there is a problem, just exit out of the function instead
                     # of looping to infinity.
                     self.receiver_connection.close()
@@ -930,9 +930,9 @@
 
 class CloseWithUnsettledTest(MessagingHandler):
     ##
-    ## This test sends a message across an attach-routed link.  While the message
-    ## is unsettled, the client link is closed.  The test is ensuring that the
-    ## router does not crash during the closing of the links.
+    # This test sends a message across an attach-routed link.  While the message
+    # is unsettled, the client link is closed.  The test is ensuring that the
+    # router does not crash during the closing of the links.
     ##
     def __init__(self, normal_addr, route_addr):
         super(CloseWithUnsettledTest, self).__init__(prefetch=0, auto_accept=False)
@@ -978,8 +978,8 @@
 
 class DynamicSourceTest(MessagingHandler):
     ##
-    ## This test verifies that a dynamic source can be propagated via link-route to
-    ## a route-container.
+    # This test verifies that a dynamic source can be propagated via link-route to
+    # a route-container.
     ##
     def __init__(self, normal_addr, route_addr):
         super(DynamicSourceTest, self).__init__(prefetch=0, auto_accept=False)
@@ -1002,7 +1002,7 @@
         if event.connection == self.conn_route:
             self.conn_normal = event.container.connect(self.normal_addr)
         elif event.connection == self.conn_normal:
-            self.receiver = event.container.create_receiver(self.conn_normal, None, dynamic=True,options=DynamicNodeProperties({"x-opt-qd.address":u"pulp.task.abc"}))
+            self.receiver = event.container.create_receiver(self.conn_normal, None, dynamic=True, options=DynamicNodeProperties({"x-opt-qd.address": u"pulp.task.abc"}))
 
     def on_link_opened(self, event):
         if event.receiver == self.receiver:
@@ -1035,8 +1035,8 @@
 
 class DynamicTargetTest(MessagingHandler):
     ##
-    ## This test verifies that a dynamic source can be propagated via link-route to
-    ## a route-container.
+    # This test verifies that a dynamic source can be propagated via link-route to
+    # a route-container.
     ##
     def __init__(self, normal_addr, route_addr):
         super(DynamicTargetTest, self).__init__(prefetch=0, auto_accept=False)
@@ -1059,8 +1059,7 @@
         if event.connection == self.conn_route:
             self.conn_normal = event.container.connect(self.normal_addr)
         elif event.connection == self.conn_normal:
-            self.sender = event.container.create_sender(self.conn_normal, None, options=\
-                                                        [DynamicTarget(), DynamicNodeProperties({"x-opt-qd.address":u"pulp.task.abc"})])
+            self.sender = event.container.create_sender(self.conn_normal, None, options=[DynamicTarget(), DynamicNodeProperties({"x-opt-qd.address": u"pulp.task.abc"})])
 
     def on_link_opened(self, event):
         if event.sender == self.sender:
@@ -1087,7 +1086,7 @@
 
 class DetachNoCloseTest(MessagingHandler):
     ##
-    ## This test verifies that link-detach (not close) is propagated properly
+    # This test verifies that link-detach (not close) is propagated properly
     ##
     def __init__(self, normal_addr, route_addr):
         super(DetachNoCloseTest, self).__init__(prefetch=0, auto_accept=False)
@@ -1125,7 +1124,7 @@
             self.sender.detach()
         if event.receiver == self.receiver:
             ##
-            ## Test passed, we expected a detach on the propagated sender and back
+            # Test passed, we expected a detach on the propagated sender and back
             ##
             self.stop()
 
@@ -1150,7 +1149,7 @@
 
 class DetachMixedCloseTest(MessagingHandler):
     ##
-    ## This test verifies that link-detach (not close) is propagated properly
+    # This test verifies that link-detach (not close) is propagated properly
     ##
     def __init__(self, normal_addr, route_addr):
         super(DetachMixedCloseTest, self).__init__(prefetch=0, auto_accept=False)
@@ -1197,7 +1196,7 @@
 
         if event.receiver == self.receiver:
             ##
-            ## Test Passed
+            # Test Passed
             ##
             self.stop()
 
@@ -1262,7 +1261,7 @@
     def on_link_opened(self, event):
         if event.receiver:
             if event.receiver.name in list(self.receiver_dict):
-                self.receiver_attaches+=1
+                self.receiver_attaches += 1
             # The response receiver attaches have been received. The receiver sent attaches which was link routed
             # all the way to the 'broker' router and the response attaches have come back.
             # It is now time to create the sender.
@@ -1318,6 +1317,7 @@
     pulp.task.terminusTestReceiver address shows up with an 'in' and 'out'
 
     """
+
     def __init__(self, sender_address, listening_address, query_address_sending, query_address_listening):
         super(TerminusAddrTest, self).__init__()
         self.sender_address = sender_address
@@ -1352,7 +1352,7 @@
             # router so that the address Dpulp.task can show up on the remoteCount
             i = 0
             while continue_loop:
-                if i > 100: # If we have run the read command for more than hundred times and we still do not have
+                if i > 100:  # If we have run the read command for more than hundred times and we still do not have
                     # the remoteCount set to 1, there is a problem, just exit out of the function instead
                     # of looping to infinity.
                     self.receiver_connection.close()
@@ -1418,6 +1418,7 @@
     def run(self):
         Container(self).run()
 
+
 class MultiLinkSendReceive(MessagingHandler):
     class SendState(object):
         def __init__(self, link):
@@ -1429,7 +1430,7 @@
 
         def send(self, subject, body):
             if not self.sent:
-                self.link.send(Message(subject=subject,body=body,address=self.link.target.address))
+                self.link.send(Message(subject=subject, body=body, address=self.link.target.address))
                 self.sent = True
 
         def on_accepted(self):
@@ -1591,6 +1592,7 @@
     """DISPATCH-1092: force a session close when the link closes.  This should
     cause the router to re-create the session when the next client attaches.
     """
+
     def __init__(self, url):
         super(SessionKiller, self).__init__(url)
 
@@ -1605,6 +1607,7 @@
     when drain is issued by a receiver connected to the router on a
     link routed address
     """
+
     def __init__(self, url):
         super(FakeBrokerDrain, self).__init__(url)
         self.first_flow_received = False
@@ -1782,7 +1785,6 @@
 
     _AS_TYPE = "org.apache.qpid.dispatch.router.connection.linkRoute"
 
-
     @classmethod
     def setUpClass(cls):
         super(ConnectionLinkRouteTest, cls).setUpClass()
@@ -1818,9 +1820,9 @@
                            'host': '0.0.0.0',
                            'port': b_port,
                            'saslMechanisms': 'ANONYMOUS'})]
-            ]
+        ]
 
-        cls.routers=[]
+        cls.routers = []
         for c in configs:
             config = Qdrouterd.Config(c)
             cls.routers.append(cls.tester.qdrouterd(config=config, wait=False))
@@ -1839,14 +1841,14 @@
         # file fails
         config = [('router', {'mode': 'interior', 'id': 'QDR.X'}),
                   ('listener', {'role': 'normal',
-                           'host': '0.0.0.0',
-                           'port': self.tester.get_port(),
-                           'saslMechanisms': 'ANONYMOUS'}),
+                                'host': '0.0.0.0',
+                                'port': self.tester.get_port(),
+                                'saslMechanisms': 'ANONYMOUS'}),
 
                   ('connection.linkRoute',
                    {'pattern': "i/am/bad",
                     'direction': "out"})
-        ]
+                  ]
 
         cfg = Qdrouterd.Config(config)
         # we expect the router to fail
@@ -1910,12 +1912,12 @@
     def test_address_propagation(self):
         # test service that creates and deletes connection link routes
         fs = ConnLinkRouteService(self.QDR_A.addresses[1], container_id="FakeService",
-                                  config = [("clr1",
-                                             {"pattern": "flea.*",
-                                              "direction": "out"}),
-                                            ("clr2",
-                                             {"pattern": "flea.*",
-                                              "direction": "in"})])
+                                  config=[("clr1",
+                                           {"pattern": "flea.*",
+                                            "direction": "out"}),
+                                          ("clr2",
+                                           {"pattern": "flea.*",
+                                            "direction": "in"})])
         self.assertEqual(2, len(fs.values))
 
         # the address should propagate to A and B
@@ -1934,7 +1936,7 @@
             self.assertTrue(time() < deadline)
             sleep(0.1)
 
-        fs.join();
+        fs.join()
 
     # simple forwarding tests with auto delete
     def test_send_receive(self):
@@ -1944,12 +1946,12 @@
 
         # connect broker to A route-container
         fs = ConnLinkRouteService(self.QDR_A.addresses[1], container_id="FakeService",
-                                  config = [("clr1",
-                                             {"pattern": "flea.*",
-                                              "direction": "out"}),
-                                            ("clr2",
-                                             {"pattern": "flea.*",
-                                              "direction": "in"})])
+                                  config=[("clr1",
+                                           {"pattern": "flea.*",
+                                            "direction": "out"}),
+                                          ("clr2",
+                                           {"pattern": "flea.*",
+                                            "direction": "in"})])
         self.assertEqual(2, len(fs.values))
 
         # wait for the address to propagate to B
@@ -2125,6 +2127,7 @@
     While the connection remains open the connection scoped links will remain
     configured and active
     """
+
     def __init__(self, bconn, credit=250):
         self._receiver = bconn.create_receiver(address=None, dynamic=True, credit=credit)
         self._sender = bconn.create_sender(address="$management")
@@ -2136,6 +2139,7 @@
         f = getattr(self._proxy, key)
         if not callable(f):
             return f
+
         def _func(*args, **kwargs):
             self._sender.send(f(*args, **kwargs))
             return self._proxy.response(self._receiver.receive())
@@ -2145,13 +2149,14 @@
 class InvalidTagTest(MessagingHandler):
     """Verify that a message with an invalid tag length is rejected
     """
+
     def __init__(self, router_addr):
         super(InvalidTagTest, self).__init__(auto_accept=False, auto_settle=False)
         self.test_conn = None
         self.test_address = router_addr
-        self.tx_ct = 0;
-        self.accept_ct = 0;
-        self.reject_ct = 0;
+        self.tx_ct = 0
+        self.accept_ct = 0
+        self.reject_ct = 0
         self.error = None
 
     def timeout(self):
@@ -2198,6 +2203,7 @@
     def run(self):
         Container(self).run()
 
+
 class Dispatch1428(TestCase):
     """
     Sets up 2 routers (one of which are acting as brokers (QDR.A)).
@@ -2222,7 +2228,7 @@
         def router(name, connection):
 
             config = [
-                ('router', {'mode': 'interior', 'id': 'QDR.%s'%name}),
+                ('router', {'mode': 'interior', 'id': 'QDR.%s' % name}),
             ] + connection
 
             config = Qdrouterd.Config(config)
@@ -2245,7 +2251,6 @@
                )
         sleep(2)
 
-
     def run_qdmanage(self, cmd, input=None, expect=Process.EXIT_OK, address=None):
         p = self.popen(
             ['qdmanage'] + cmd.split(' ') + ['--bus', address or self.address(), '--indent=-1', '--timeout', str(TIMEOUT)],
@@ -2291,7 +2296,6 @@
         # we can continue further testing.
         self.assertTrue(all_link_routes_activated)
 
-
         first = SendReceive("%s/foo" % self.routers[1].addresses[0], "%s/foo" % self.routers[0].addresses[0])
         first.run()
         self.assertEqual(None, first.error)
@@ -2353,6 +2357,7 @@
     Capture the outgoing delivery after the remote has set its terminal
     outcome.  Used by tests that need to examine the delivery state
     """
+
     def __init__(self, send_url):
         super(DispositionSniffer, self).__init__(auto_accept=False,
                                                  auto_settle=False)
@@ -2449,7 +2454,7 @@
              # the routes
              ('linkRoute', {'prefix': 'closest/test-client', 'containerId': 'FakeService', 'direction': 'in'}),
              ('linkRoute', {'prefix': 'closest/test-client', 'containerId': 'FakeService', 'direction': 'out'})
-            ],
+             ],
             # QDR.B:
             [('router', {'mode': 'interior', 'id': 'QDR.B'}),
              # for client connections
@@ -2464,7 +2469,7 @@
                            'saslMechanisms': 'ANONYMOUS'}),
              ('linkRoute', {'prefix': 'closest/test-client', 'direction': 'in'}),
              ('linkRoute', {'prefix': 'closest/test-client', 'direction': 'out'})
-            ],
+             ],
             # QDR.C
             [('router', {'mode': 'interior', 'id': 'QDR.C'}),
              # for client connections
@@ -2479,10 +2484,10 @@
                             'saslMechanisms': 'ANONYMOUS'}),
              ('linkRoute', {'prefix': 'closest/test-client', 'direction': 'in'}),
              ('linkRoute', {'prefix': 'closest/test-client', 'direction': 'out'})
-            ]
+             ]
         ]
 
-        cls.routers=[]
+        cls.routers = []
         for c in configs:
             config = Qdrouterd.Config(c)
             cls.routers.append(cls.tester.qdrouterd(config=config, wait=False))
@@ -2631,5 +2636,6 @@
         """
         pass
 
+
 if __name__ == '__main__':
     unittest.main(main_module())
diff --git a/tests/system_tests_link_routes_add_external_prefix.py b/tests/system_tests_link_routes_add_external_prefix.py
index 8813eef..7e36532 100644
--- a/tests/system_tests_link_routes_add_external_prefix.py
+++ b/tests/system_tests_link_routes_add_external_prefix.py
@@ -28,14 +28,17 @@
 from proton.reactor import Container
 import json
 
+
 def parse_record(fields, line):
     return [line[f[0]:f[1]].strip() for f in fields]
 
+
 def parse_fields(header, items):
     pos = [header.find(name) for name in header.split()] + [len(header)]
     fields = list(zip(pos, pos[1:]))
     return [parse_record(fields, item) for item in items]
 
+
 class LinkRouteTest(TestCase):
     """
     Tests the addExternalPrefix property of the linkRoute entity on the dispatch router.
@@ -63,7 +66,7 @@
         def router(name, connection):
 
             config = [
-                ('router', {'mode': 'interior', 'id': 'QDR.%s'%name}),
+                ('router', {'mode': 'interior', 'id': 'QDR.%s' % name}),
             ] + connection
 
             config = Qdrouterd.Config(config)
@@ -84,11 +87,11 @@
                    ('connector', {'name': 'broker', 'role': 'route-container', 'host': '0.0.0.0', 'port': a_listener_port, 'saslMechanisms': 'ANONYMOUS'}),
                    ('connector', {'name': 'routerC', 'role': 'inter-router', 'host': '0.0.0.0', 'port': c_listener_port}),
 
-                   ('linkRoute', {'prefix': 'foo', 'containerId': 'QDR.A', 'direction': 'in', 'addExternalPrefix':'bar.'}),
-                   ('linkRoute', {'prefix': 'foo', 'containerId': 'QDR.A', 'direction': 'out', 'addExternalPrefix':'bar.'}),
+                   ('linkRoute', {'prefix': 'foo', 'containerId': 'QDR.A', 'direction': 'in', 'addExternalPrefix': 'bar.'}),
+                   ('linkRoute', {'prefix': 'foo', 'containerId': 'QDR.A', 'direction': 'out', 'addExternalPrefix': 'bar.'}),
 
-                   ('linkRoute', {'prefix': 'qdr-a', 'containerId': 'QDR.A', 'direction': 'in', 'delExternalPrefix':'qdr-a.'}),
-                   ('linkRoute', {'prefix': 'qdr-a', 'containerId': 'QDR.A', 'direction': 'out', 'delExternalPrefix':'qdr-a.'})
+                   ('linkRoute', {'prefix': 'qdr-a', 'containerId': 'QDR.A', 'direction': 'in', 'delExternalPrefix': 'qdr-a.'}),
+                   ('linkRoute', {'prefix': 'qdr-a', 'containerId': 'QDR.A', 'direction': 'out', 'delExternalPrefix': 'qdr-a.'})
 
                ]
                )
@@ -97,12 +100,12 @@
                    ('listener', {'host': '0.0.0.0', 'role': 'normal', 'port': cls.tester.get_port(), 'saslMechanisms': 'ANONYMOUS'}),
                    ('listener', {'host': '0.0.0.0', 'role': 'inter-router', 'port': c_listener_port, 'saslMechanisms': 'ANONYMOUS'}),
 
-                   ('linkRoute', {'prefix': 'foo', 'direction': 'in', 'addExternalPrefix':'bar.'}),
-                   ('linkRoute', {'prefix': 'foo', 'direction': 'out', 'addExternalPrefix':'bar.'}),
+                   ('linkRoute', {'prefix': 'foo', 'direction': 'in', 'addExternalPrefix': 'bar.'}),
+                   ('linkRoute', {'prefix': 'foo', 'direction': 'out', 'addExternalPrefix': 'bar.'}),
 
-                   ('linkRoute', {'prefix': 'qdr-a', 'direction': 'in', 'delExternalPrefix':'qdr-a.'}),
-                   ('linkRoute', {'prefix': 'qdr-a', 'direction': 'out', 'delExternalPrefix':'qdr-a.'})
-                ]
+                   ('linkRoute', {'prefix': 'qdr-a', 'direction': 'in', 'delExternalPrefix': 'qdr-a.'}),
+                   ('linkRoute', {'prefix': 'qdr-a', 'direction': 'out', 'delExternalPrefix': 'qdr-a.'})
+               ]
                )
 
         # Wait for the routers to locate each other, and for route propagation
@@ -116,12 +119,12 @@
         sleep(2)
 
     def run_qdstat_linkRoute(self, address, args=None):
-        cmd = ['qdstat', '--bus', str(address), '--timeout', str(TIMEOUT) ] + ['--linkroute']
+        cmd = ['qdstat', '--bus', str(address), '--timeout', str(TIMEOUT)] + ['--linkroute']
         if args:
             cmd = cmd + args
         p = self.popen(
             cmd,
-            name='qdstat-'+self.id(), stdout=PIPE, expect=None,
+            name='qdstat-' + self.id(), stdout=PIPE, expect=None,
             universal_newlines=True)
 
         out = p.communicate()[0]
@@ -143,7 +146,7 @@
     def test_qdstat_link_routes_on_B(self):
         output = self.run_qdstat_linkRoute(self.routers[1].addresses[0])
         lines = output.split("\n")
-        self.assertEqual(len(lines), 11) # 4 links, 3 lines of header and an empty line at the end
+        self.assertEqual(len(lines), 11)  # 4 links, 3 lines of header and an empty line at the end
         header = lines[4]
         columns = header.split()
         self.assertEqual(len(columns), 6)
diff --git a/tests/system_tests_log_level_update.py b/tests/system_tests_log_level_update.py
index 9461fc0..db7e5fa 100644
--- a/tests/system_tests_log_level_update.py
+++ b/tests/system_tests_log_level_update.py
@@ -28,6 +28,7 @@
 
 apply_options = AtMostOnce()
 
+
 class ManyLogFilesTest(TestCase):
     @classmethod
     def setUpClass(cls):
@@ -71,7 +72,7 @@
         TEST_ADDRESS = "test_multiple_log_file"
 
         blocking_receiver = blocking_connection.create_receiver(address=TEST_ADDRESS)
-        blocking_sender = blocking_connection.create_sender(address=TEST_ADDRESS,  options=apply_options)
+        blocking_sender = blocking_connection.create_sender(address=TEST_ADDRESS, options=apply_options)
 
         TEST_MSG = "LOGTEST"
         msg = Message(body=TEST_MSG)
@@ -86,7 +87,7 @@
                     parts = line.split(" ")
                     if (parts[3] != "SERVER"):
                         all_server_logs = False
-                        break;
+                        break
         except:
             server_log_found = False
 
@@ -94,14 +95,14 @@
         self.assertTrue(server_log_found)
 
         protocol_log_found = True
-        all_protocol_logs =True
+        all_protocol_logs = True
         try:
             with open(self.router.outdir + '/test-router-protocol.log', 'r') as protocol_log:
                 for line in protocol_log:
                     parts = line.split(" ")
                     if (parts[3] != "PROTOCOL"):
                         all_protocol_logs = False
-                        break;
+                        break
         except:
             protocol_log_found = False
 
@@ -116,7 +117,7 @@
                     parts = line.split(" ")
                     if parts[3] != "ROUTER_CORE" and parts[3] != "ROUTER":
                         all_core_router_logs = False
-                        break;
+                        break
 
         except:
             core_router_log_found = False
@@ -146,7 +147,7 @@
         if not blocking_connection:
             blocking_connection = BlockingConnection(self.address)
         blocking_receiver = blocking_connection.create_receiver(address=test_address)
-        blocking_sender = blocking_connection.create_sender(address=test_address,  options=apply_options)
+        blocking_sender = blocking_connection.create_sender(address=test_address, options=apply_options)
         msg = Message(body=test_msg)
         blocking_sender.send(msg)
         received_message = blocking_receiver.receive()
@@ -229,7 +230,7 @@
         def router(name, connection):
 
             config = [
-                ('router', {'mode': 'interior', 'id': 'QDR.%s'%name}),
+                ('router', {'mode': 'interior', 'id': 'QDR.%s' % name}),
                 ('listener', {'port': cls.tester.get_port()}),
                 connection
             ]
@@ -351,7 +352,6 @@
         container_1.container_id = CONTAINER_ID_1
         conn_1 = BlockingConnection(self.address, container=container_1)
 
-
         TEST_ADDR_2 = "EnableConnectionLevelProtocolTraceTest1"
         CONTAINER_ID_2 = "CONTAINERID_2"
         container_2 = Container()
@@ -390,11 +390,10 @@
         # turned on for that connection
         self.assertTrue(num_attaches_2 == 0)
 
-
         # Now turn off the connection tracing on that connection
         qd_manager.update("org.apache.qpid.dispatch.connection",
-                                      {"enableProtocolTrace": "off"},
-                                      identity=conn_id)
+                          {"enableProtocolTrace": "off"},
+                          identity=conn_id)
         blocking_receiver_1.close()
         blocking_sender_1.close()
 
@@ -411,6 +410,7 @@
         conn_1.close()
         conn_2.close()
 
+
 class LogLevelUpdateTest(TestCase):
     @classmethod
     def setUpClass(cls):
@@ -434,7 +434,7 @@
         if not blocking_connection:
             blocking_connection = BlockingConnection(self.address)
         blocking_receiver = blocking_connection.create_receiver(address=test_address)
-        blocking_sender = blocking_connection.create_sender(address=test_address,  options=apply_options)
+        blocking_sender = blocking_connection.create_sender(address=test_address, options=apply_options)
         msg = Message(body=test_msg)
         blocking_sender.send(msg)
         received_message = blocking_receiver.receive()
@@ -483,7 +483,6 @@
         # because we turned of trace logging.
         self.assertTrue(num_attaches == 0)
 
-
         # STEP 4: Tuen trace logging back on again and make sure num_attaches = 4
         TEST_ADDR = "apachetest3"
         qd_manager.update("org.apache.qpid.dispatch.log", {"enable": "trace+"}, name="log/DEFAULT")
@@ -514,7 +513,6 @@
 
         self.assertTrue(num_attaches == 4)
 
-
     def test_02_toggle_server_trace_logging(self):
         """
         This test is similar to test_01_toggle_default_trace_logging but it tests the
@@ -575,7 +573,6 @@
         self.assertTrue(num_attaches == 0)
 
 
-
 class RouterCoreModuleLogTest(TestCase):
     @classmethod
     def setUpClass(cls):
@@ -598,14 +595,13 @@
         cls.router.wait_ready()
         cls.address = cls.router.addresses[0]
 
-
     def test_router_core_logger(self):
         blocking_connection = BlockingConnection(self.address)
 
         TEST_ADDRESS = "test_multiple_log_file"
 
         blocking_receiver = blocking_connection.create_receiver(address=TEST_ADDRESS)
-        blocking_sender = blocking_connection.create_sender(address=TEST_ADDRESS,  options=apply_options)
+        blocking_sender = blocking_connection.create_sender(address=TEST_ADDRESS, options=apply_options)
 
         TEST_MSG_BODY = "LOGTEST"
         msg = Message(body=TEST_MSG_BODY)
@@ -632,7 +628,7 @@
             with open(self.router.outdir + '/test-router-core.log', 'r') as core_log:
                 for line in core_log:
                     # Every line in the file must log to the router core module.
-                    if not "ROUTER_CORE" in line:
+                    if "ROUTER_CORE" not in line:
                         all_lines_router_core = False
                         break
         except:
@@ -640,4 +636,3 @@
 
         self.assertTrue(core_log_file_found)
         self.assertTrue(all_lines_router_core)
-
diff --git a/tests/system_tests_log_message_components.py b/tests/system_tests_log_message_components.py
index b93720a..4226bc1 100644
--- a/tests/system_tests_log_message_components.py
+++ b/tests/system_tests_log_message_components.py
@@ -32,7 +32,6 @@
 from qpid_dispatch_internal.compat import BINARY
 
 
-
 class RouterMessageLogTestBase(TestCase):
     def run_qdmanage(self, cmd, input=None, expect=Process.EXIT_OK, address=None):
         p = self.popen(
@@ -50,6 +49,7 @@
             raise Exception("%s\n%s" % (e, out))
         return out
 
+
 class RouterMessageLogTestAll(RouterMessageLogTestBase):
     """System tests to check log messages emitted by router"""
     @classmethod
@@ -83,7 +83,7 @@
         message_logs = [log for log in logs if log[0] == u'MESSAGE']
         self.assertTrue(message_logs)
         test_message = [log for log in message_logs if "message-id=\"123455\"" in log[2]]
-        self.assertTrue(2 == len(test_message), message_logs) # Sent and Received
+        self.assertTrue(2 == len(test_message), message_logs)  # Sent and Received
         self.assertIn('Received', test_message[0][2])
         self.assertIn('Sent', test_message[1][2])
         for log in test_message:
@@ -98,6 +98,7 @@
             self.assertIn('creation-time="2017-02-22', log[2])
             self.assertIn('10:23.883', log[2])
 
+
 class RouterMessageLogTestNone(RouterMessageLogTestBase):
     """System tests to check log messages emitted by router"""
     @classmethod
@@ -133,6 +134,7 @@
 
         self.assertTrue(everything_ok)
 
+
 class RouterMessageLogTestSome(RouterMessageLogTestBase):
     """System tests to check log messages emitted by router"""
     @classmethod
@@ -172,6 +174,7 @@
                         u'Sent Message{user-id=b"testuser", subject="test-subject", reply-to="hello_world"}' in log[2]]
         self.assertTrue(test_message, message_logs)
 
+
 class LogMessageTest(MessagingHandler):
     def __init__(self, address):
         super(LogMessageTest, self).__init__(auto_accept=False)
diff --git a/tests/system_tests_management.py b/tests/system_tests_management.py
index ac59c36..5c4f6d0 100644
--- a/tests/system_tests_management.py
+++ b/tests/system_tests_management.py
@@ -24,7 +24,10 @@
 from __future__ import absolute_import
 from __future__ import print_function
 
-import system_test, re, os, json
+import system_test
+import re
+import os
+import json
 from proton.handlers import MessagingHandler
 from proton.reactor import Container
 from proton import Message
@@ -49,6 +52,7 @@
 NODE = ROUTER + '.node'
 CONFIG_ADDRESS = ROUTER + '.config.address'
 
+
 def short_name(name):
     if name.startswith(PREFIX):
         return name[len(PREFIX):]
@@ -61,38 +65,38 @@
     def setUpClass(cls):
         super(ManagementTest, cls).setUpClass()
         # Stand-alone router
-        conf0=Qdrouterd.Config([
-            ('router', { 'mode': 'standalone', 'id': 'solo', 'metadata': 'selftest;solo'}),
-            ('listener', {'name': 'l0', 'port':cls.get_port(), 'role':'normal'}),
+        conf0 = Qdrouterd.Config([
+            ('router', {'mode': 'standalone', 'id': 'solo', 'metadata': 'selftest;solo'}),
+            ('listener', {'name': 'l0', 'port': cls.get_port(), 'role': 'normal'}),
             # Extra listeners to exercise managment query
-            ('listener', {'name': 'l1', 'port':cls.get_port(), 'role':'normal'}),
-            ('listener', {'name': 'l2', 'port':cls.get_port(), 'role':'normal'})
+            ('listener', {'name': 'l1', 'port': cls.get_port(), 'role': 'normal'}),
+            ('listener', {'name': 'l2', 'port': cls.get_port(), 'role': 'normal'})
         ])
         cls._router = cls.tester.qdrouterd(config=conf0, wait=False)
 
         # Trio of interior routers linked in a line so we can see some next-hop values.
         conf0 = Qdrouterd.Config([
-            ('router', { 'mode': 'interior', 'id': 'router0'}),
-            ('listener', {'port':cls.get_port(), 'role':'normal'}),
-            ('listener', {'port':cls.get_port(), 'role':'inter-router'})
+            ('router', {'mode': 'interior', 'id': 'router0'}),
+            ('listener', {'port': cls.get_port(), 'role': 'normal'}),
+            ('listener', {'port': cls.get_port(), 'role': 'inter-router'})
         ])
         conf1 = Qdrouterd.Config([
-            ('router', { 'mode': 'interior', 'id': 'router1'}),
-            ('listener', {'port':cls.get_port(), 'role':'normal'}),
-            ('connector', {'port':conf0.sections('listener')[1]['port'], 'role':'inter-router'}),
-            ('listener', {'port':cls.get_port(), 'role':'inter-router'})
+            ('router', {'mode': 'interior', 'id': 'router1'}),
+            ('listener', {'port': cls.get_port(), 'role': 'normal'}),
+            ('connector', {'port': conf0.sections('listener')[1]['port'], 'role':'inter-router'}),
+            ('listener', {'port': cls.get_port(), 'role': 'inter-router'})
         ])
         conf2 = Qdrouterd.Config([
-            ('router', { 'mode': 'interior', 'id': 'router2'}),
-            ('listener', {'port':cls.get_port(), 'role':'normal'}),
-            ('connector', {'port':conf1.sections('listener')[1]['port'], 'role':'inter-router'})
+            ('router', {'mode': 'interior', 'id': 'router2'}),
+            ('listener', {'port': cls.get_port(), 'role': 'normal'}),
+            ('connector', {'port': conf1.sections('listener')[1]['port'], 'role':'inter-router'})
         ])
         cls._routers = [cls.tester.qdrouterd(config=c, wait=False) for c in [conf0, conf1, conf2]]
 
         # Standalone router for logging tests (avoid interfering with logging for other tests.)
-        conflog=Qdrouterd.Config([
-            ('router', { 'mode': 'standalone', 'id': 'logrouter'}),
-            ('listener', {'port':cls.get_port(), 'role':'normal'}),
+        conflog = Qdrouterd.Config([
+            ('router', {'mode': 'standalone', 'id': 'logrouter'}),
+            ('listener', {'port': cls.get_port(), 'role': 'normal'}),
         ])
         cls._logrouter = cls.tester.qdrouterd(config=conflog, wait=False)
 
@@ -116,7 +120,7 @@
 
     def setUp(self):
         super(ManagementTest, self).setUp()
-        self._routers = None # Wait on demand
+        self._routers = None  # Wait on demand
         self.maxDiff = None
         self.longMessage = True
         self.node = self.cleanup(Node.connect(self.router.addresses[0]))
@@ -148,17 +152,17 @@
 
     def test_query_type_attributes(self):
         """Query with type and attribute names"""
-        attribute_names=['type', 'name', 'port']
+        attribute_names = ['type', 'name', 'port']
         response = self.node.query(type=LISTENER, attribute_names=attribute_names)
         self.assertEqual(attribute_names, response.attribute_names)
         expect = [[LISTENER, 'l%s' % i, str(self.router.ports[i])] for i in range(3)]
-        for r in expect: # We might have extras in results due to create tests
+        for r in expect:  # We might have extras in results due to create tests
             self.assertIn(r, response.results)
             self.assertIn(dict(zip(attribute_names, r)), response.get_dicts())
 
     def test_query_attributes(self):
         """Query with attributes only"""
-        attribute_names=['type', 'name', 'port']
+        attribute_names = ['type', 'name', 'port']
         response = self.node.query(attribute_names=attribute_names)
         self.assertEqual(attribute_names, response.attribute_names)
         expect = [[LISTENER, 'l%s' % i, str(self.router.ports[i])] for i in range(3)]
@@ -171,7 +175,7 @@
     def assertMapSubset(self, small, big):
         """Assert that mapping small is a subset of mapping big"""
         missing = [(k, v) for k, v in small.items() if (k, v) not in big.items()]
-        assert not missing, "Not a subset, missing %s, sub=%s, super=%s"%(missing, small, big)
+        assert not missing, "Not a subset, missing %s, sub=%s, super=%s" % (missing, small, big)
 
     def assert_create_ok(self, type, name, attributes):
         entity = self.node.create(attributes, type, name)
@@ -188,7 +192,7 @@
 
         port = self.get_port()
         # Note qdrouter schema defines port as string not int, since it can be a service name.
-        attributes = {'name':'foo', 'port':str(port), 'role':'normal', 'saslMechanisms': 'ANONYMOUS', 'authenticatePeer': False}
+        attributes = {'name': 'foo', 'port': str(port), 'role': 'normal', 'saslMechanisms': 'ANONYMOUS', 'authenticatePeer': False}
         entity = self.assert_create_ok(LISTENER, 'foo', attributes)
         self.assertEqual(entity['name'], 'foo')
         self.assertEqual(entity['host'], '')
@@ -219,13 +223,13 @@
                           u'includeTimestamp': True,
                           u'type': u'org.apache.qpid.dispatch.log'})
 
-
         def check_log(log, error=True, debug=False):
             """Cause an error and check for expected error and debug logs"""
             bad_type = "nosuch"
             self.assertRaises(ManagementError, node.create, type=bad_type, name=bad_type)
             f = self.cleanup(open(log))
             logstr = f.read()
+
             def assert_expected(expect, regex, logstr):
                 match = re.search(regex, logstr)
                 assert bool(expect) == bool(match), "%s %s:\n%s" % (
@@ -246,7 +250,7 @@
         # Expect error but no debug
         update_check_log(dict(enable="warning+"))
         update_check_log(dict(enable="error"))
-        update_check_log(dict(enable="TRACE , Error info")) # Case and space insensitive
+        update_check_log(dict(enable="TRACE , Error info"))  # Case and space insensitive
 
         # Expect no error if not enabled.
         update_check_log(dict(enable="info,critical"), error=False)
@@ -340,7 +344,7 @@
         dummy2 = self.node.read(type=DUMMY, name='MyDummy')
         self.assertEqual(dummy.attributes, dummy2.attributes)
 
-        integers = [0, 1, 42, (2**63)-1, -1, -42, -(2**63)]
+        integers = [0, 1, 42, (2**63) - 1, -1, -42, -(2**63)]
         test_data = [BINARY("bytes"), u"string"] + integers
         for data in test_data:
             try:
@@ -433,7 +437,8 @@
         result = self.node.get_operations(type=DUMMY)
         self.assertEqual({DUMMY: ["CREATE", "READ", "UPDATE", "DELETE", "CALLME"]}, result)
         result = self.node.get_operations()
-        for type in LISTENER, LINK: self.assertIn(type, result)
+        for type in LISTENER, LINK:
+            self.assertIn(type, result)
         self.assertEqual(["UPDATE", "READ"], result[LINK])
 
     def test_get_attributes(self):
@@ -441,8 +446,10 @@
         self.assertEqual(set([u'arg1', u'arg2', u'num1', u'num2', u'name', u'identity', u'type']),
                          set(result[DUMMY]))
         result = self.node.get_attributes()
-        for type in LISTENER, LINK: self.assertIn(type, result)
-        for a in ['linkType', 'linkDir', 'owningAddr']: self.assertIn(a, result[LINK])
+        for type in LISTENER, LINK:
+            self.assertIn(type, result)
+        for a in ['linkType', 'linkDir', 'owningAddr']:
+            self.assertIn(a, result[LINK])
 
     def test_standalone_no_inter_router(self):
         """Verify that we do not allow inter-router connectors or listeners in standalone mode"""
@@ -457,17 +464,17 @@
             self.node.create, dict(attrs, type=CONNECTOR, name="bad2", port=str(self.get_port())))
 
         conf = Qdrouterd.Config([
-            ('router', { 'mode': 'standalone', 'id': 'all_by_myself1'}),
-            ('listener', {'port':self.get_port(), 'role':'inter-router'})
+            ('router', {'mode': 'standalone', 'id': 'all_by_myself1'}),
+            ('listener', {'port': self.get_port(), 'role': 'inter-router'})
         ])
         r = self.qdrouterd('routerX', conf, wait=False)
         r.expect = Process.EXIT_FAIL
         self.assertTrue(r.wait() != 0)
 
         conf = Qdrouterd.Config([
-            ('router', { 'mode': 'standalone', 'id': 'all_by_myself2'}),
-            ('listener', {'port':self.get_port(), 'role':'normal'}),
-            ('connector', {'port':self.get_port(), 'role':'inter-router'})
+            ('router', {'mode': 'standalone', 'id': 'all_by_myself2'}),
+            ('listener', {'port': self.get_port(), 'role': 'normal'}),
+            ('connector', {'port': self.get_port(), 'role': 'inter-router'})
         ])
         r = self.qdrouterd('routerY', conf, wait=False)
         r.expect = Process.EXIT_FAIL
diff --git a/tests/system_tests_multi_phase.py b/tests/system_tests_multi_phase.py
index de3f4ac..4c4aad4 100644
--- a/tests/system_tests_multi_phase.py
+++ b/tests/system_tests_multi_phase.py
@@ -31,6 +31,7 @@
 from proton.handlers import MessagingHandler
 from proton.reactor import Container
 
+
 class AddrTimer(object):
     def __init__(self, parent):
         self.parent = parent
@@ -80,7 +81,6 @@
         cls.routers[0].wait_router_connected('INT.B')
         cls.routers[1].wait_router_connected('INT.A')
 
-
     def test_01_waypoint_same_interior(self):
         test = WaypointTest(self.routers[0].addresses[0],
                             self.routers[0].addresses[0],
@@ -206,8 +206,8 @@
                                   self.routers[0].addresses[0],
                                   self.routers[1].addresses[0],
                                   self.routers[2].addresses[0]
-                              ],
-                              'multi.15')
+        ],
+            'multi.15')
         test.run()
         self.assertEqual(None, test.error)
 
@@ -224,8 +224,8 @@
                                   self.routers[5].addresses[0],
                                   self.routers[3].addresses[0],
                                   self.routers[1].addresses[0]
-                              ],
-                              'multi.16')
+        ],
+            'multi.16')
         test.run()
         self.assertEqual(None, test.error)
 
@@ -242,8 +242,8 @@
                                   self.routers[0].addresses[0],
                                   self.routers[1].addresses[0],
                                   self.routers[2].addresses[0]
-                              ],
-                              'multi.17')
+        ],
+            'multi.17')
         test.run()
         self.assertEqual(None, test.error)
 
@@ -326,7 +326,7 @@
         self.error          = None
         self.n_tx           = 0
         self.n_rx           = 0
-        self.n_thru         = [0,0,0,0,0,0,0,0,0]
+        self.n_thru         = [0, 0, 0, 0, 0, 0, 0, 0, 0]
 
     def timeout(self):
         self.error = "Timeout Expired - n_tx=%d, n_rx=%d, n_thru=%r" % (self.n_tx, self.n_rx, self.n_thru)
@@ -388,5 +388,5 @@
         Container(self).run()
 
 
-if __name__== '__main__':
+if __name__ == '__main__':
     unittest.main(main_module())
diff --git a/tests/system_tests_multi_tenancy.py b/tests/system_tests_multi_tenancy.py
index c62d7b4..1edd3c6 100644
--- a/tests/system_tests_multi_tenancy.py
+++ b/tests/system_tests_multi_tenancy.py
@@ -72,7 +72,6 @@
         cls.routers[0].wait_router_connected('B')
         cls.routers[1].wait_router_connected('A')
 
-
     def test_01_one_router_targeted_sender_no_tenant(self):
         test = MessageTransferTest(self.routers[0].addresses[0],
                                    self.routers[0].addresses[0],
@@ -83,7 +82,6 @@
         test.run()
         self.assertEqual(None, test.error)
 
-
     def test_02_one_router_targeted_sender_tenant_on_sender(self):
         test = MessageTransferTest(self.routers[0].addresses[1],
                                    self.routers[0].addresses[0],
@@ -94,7 +92,6 @@
         test.run()
         self.assertEqual(None, test.error)
 
-
     def test_03_one_router_targeted_sender_tenant_on_receiver(self):
         test = MessageTransferTest(self.routers[0].addresses[0],
                                    self.routers[0].addresses[1],
@@ -105,7 +102,6 @@
         test.run()
         self.assertEqual(None, test.error)
 
-
     def test_04_one_router_targeted_sender_tenant_on_both(self):
         test = MessageTransferTest(self.routers[0].addresses[1],
                                    self.routers[0].addresses[1],
@@ -116,7 +112,6 @@
         test.run()
         self.assertEqual(None, test.error)
 
-
     def test_05_two_router_targeted_sender_no_tenant(self):
         test = MessageTransferTest(self.routers[0].addresses[0],
                                    self.routers[1].addresses[0],
@@ -127,7 +122,6 @@
         test.run()
         self.assertEqual(None, test.error)
 
-
     def test_06_two_router_targeted_sender_tenant_on_sender(self):
         test = MessageTransferTest(self.routers[0].addresses[1],
                                    self.routers[1].addresses[0],
@@ -138,7 +132,6 @@
         test.run()
         self.assertEqual(None, test.error)
 
-
     def test_07_two_router_targeted_sender_tenant_on_receiver(self):
         test = MessageTransferTest(self.routers[0].addresses[0],
                                    self.routers[1].addresses[1],
@@ -149,7 +142,6 @@
         test.run()
         self.assertEqual(None, test.error)
 
-
     def test_08_two_router_targeted_sender_tenant_on_both(self):
         test = MessageTransferTest(self.routers[0].addresses[1],
                                    self.routers[1].addresses[1],
@@ -160,7 +152,6 @@
         test.run()
         self.assertEqual(None, test.error)
 
-
     def test_09_one_router_anonymous_sender_no_tenant(self):
         test = MessageTransferAnonTest(self.routers[0].addresses[0],
                                        self.routers[0].addresses[0],
@@ -171,7 +162,6 @@
         test.run()
         self.assertEqual(None, test.error)
 
-
     def test_10_one_router_anonymous_sender_tenant_on_sender(self):
         test = MessageTransferAnonTest(self.routers[0].addresses[1],
                                        self.routers[0].addresses[0],
@@ -182,7 +172,6 @@
         test.run()
         self.assertEqual(None, test.error)
 
-
     def test_11_one_router_anonymous_sender_tenant_on_receiver(self):
         test = MessageTransferAnonTest(self.routers[0].addresses[0],
                                        self.routers[0].addresses[1],
@@ -193,7 +182,6 @@
         test.run()
         self.assertEqual(None, test.error)
 
-
     def test_12_one_router_anonymous_sender_tenant_on_both(self):
         test = MessageTransferAnonTest(self.routers[0].addresses[1],
                                        self.routers[0].addresses[1],
@@ -204,7 +192,6 @@
         test.run()
         self.assertEqual(None, test.error)
 
-
     def test_13_two_router_anonymous_sender_no_tenant(self):
         test = MessageTransferAnonTest(self.routers[0].addresses[0],
                                        self.routers[1].addresses[0],
@@ -215,7 +202,6 @@
         test.run()
         self.assertEqual(None, test.error)
 
-
     def test_14_two_router_anonymous_sender_tenant_on_sender(self):
         test = MessageTransferAnonTest(self.routers[0].addresses[1],
                                        self.routers[1].addresses[0],
@@ -226,7 +212,6 @@
         test.run()
         self.assertEqual(None, test.error)
 
-
     def test_15_two_router_anonymous_sender_tenant_on_receiver(self):
         test = MessageTransferAnonTest(self.routers[0].addresses[0],
                                        self.routers[1].addresses[1],
@@ -237,7 +222,6 @@
         test.run()
         self.assertEqual(None, test.error)
 
-
     def test_16_two_router_anonymous_sender_tenant_on_both(self):
         test = MessageTransferAnonTest(self.routers[0].addresses[1],
                                        self.routers[1].addresses[1],
@@ -248,7 +232,6 @@
         test.run()
         self.assertEqual(None, test.error)
 
-
     def test_17_one_router_link_route_targeted(self):
         test = LinkRouteTest(self.routers[0].addresses[1],
                              self.routers[0].addresses[2],
@@ -259,7 +242,6 @@
         test.run()
         self.assertEqual(None, test.error)
 
-
     def test_18_one_router_link_route_targeted_no_tenant(self):
         test = LinkRouteTest(self.routers[0].addresses[0],
                              self.routers[0].addresses[2],
@@ -270,7 +252,6 @@
         test.run()
         self.assertEqual(None, test.error)
 
-
     def test_19_one_router_link_route_dynamic(self):
         test = LinkRouteTest(self.routers[0].addresses[1],
                              self.routers[0].addresses[2],
@@ -281,7 +262,6 @@
         test.run()
         self.assertEqual(None, test.error)
 
-
     def test_20_one_router_link_route_dynamic_no_tenant(self):
         test = LinkRouteTest(self.routers[0].addresses[0],
                              self.routers[0].addresses[2],
@@ -292,7 +272,6 @@
         test.run()
         self.assertEqual(None, test.error)
 
-
     def test_21_two_router_link_route_targeted(self):
         test = LinkRouteTest(self.routers[0].addresses[1],
                              self.routers[1].addresses[2],
@@ -303,7 +282,6 @@
         test.run()
         self.assertEqual(None, test.error)
 
-
     def test_22_two_router_link_route_targeted_no_tenant(self):
         test = LinkRouteTest(self.routers[0].addresses[0],
                              self.routers[1].addresses[2],
@@ -314,7 +292,6 @@
         test.run()
         self.assertEqual(None, test.error)
 
-
     def test_23_two_router_link_route_dynamic(self):
         test = LinkRouteTest(self.routers[0].addresses[1],
                              self.routers[1].addresses[2],
@@ -325,7 +302,6 @@
         test.run()
         self.assertEqual(None, test.error)
 
-
     def test_24_two_router_link_route_dynamic_no_tenant(self):
         test = LinkRouteTest(self.routers[0].addresses[0],
                              self.routers[1].addresses[2],
@@ -336,7 +312,6 @@
         test.run()
         self.assertEqual(None, test.error)
 
-
     def test_25_one_router_anonymous_sender_non_mobile(self):
         test = MessageTransferAnonTest(self.routers[0].addresses[1],
                                        self.routers[0].addresses[0],
@@ -347,7 +322,6 @@
         test.run()
         self.assertEqual(None, test.error)
 
-
     def test_26_one_router_targeted_sender_non_mobile(self):
         test = MessageTransferTest(self.routers[0].addresses[1],
                                    self.routers[0].addresses[0],
@@ -358,7 +332,6 @@
         test.run()
         self.assertEqual(None, test.error)
 
-
     def test_27_two_router_anonymous_sender_non_mobile(self):
         test = MessageTransferAnonTest(self.routers[0].addresses[1],
                                        self.routers[1].addresses[0],
@@ -369,7 +342,6 @@
         test.run()
         self.assertEqual(None, test.error)
 
-
     def test_28_two_router_targeted_sender_non_mobile(self):
         test = MessageTransferTest(self.routers[0].addresses[1],
                                    self.routers[1].addresses[0],
@@ -380,7 +352,6 @@
         test.run()
         self.assertEqual(None, test.error)
 
-
     def test_29_one_router_waypoint_no_tenant(self):
         test = WaypointTest(self.routers[0].addresses[0],
                             self.routers[0].addresses[2],
@@ -392,7 +363,6 @@
             test.logger.dump()
         self.assertEqual(None, test.error)
 
-
     def test_30_one_router_waypoint(self):
         test = WaypointTest(self.routers[0].addresses[1],
                             self.routers[0].addresses[2],
@@ -404,7 +374,6 @@
             test.logger.dump()
         self.assertEqual(None, test.error)
 
-
     def test_31_two_router_waypoint_no_tenant(self):
         test = WaypointTest(self.routers[0].addresses[0],
                             self.routers[1].addresses[2],
@@ -416,7 +385,6 @@
             test.logger.dump()
         self.assertEqual(None, test.error)
 
-
     def test_32_two_router_waypoint(self):
         test = WaypointTest(self.routers[0].addresses[1],
                             self.routers[1].addresses[2],
@@ -428,7 +396,6 @@
             test.logger.dump()
         self.assertEqual(None, test.error)
 
-
     def test_33_one_router_waypoint_no_tenant_external_addr(self):
         test = WaypointTest(self.routers[0].addresses[0],
                             self.routers[0].addresses[2],
@@ -441,7 +408,6 @@
             test.logger.dump()
         self.assertEqual(None, test.error)
 
-
     def test_34_one_router_waypoint_external_addr(self):
         test = WaypointTest(self.routers[0].addresses[1],
                             self.routers[0].addresses[2],
@@ -454,7 +420,6 @@
             test.logger.dump()
         self.assertEqual(None, test.error)
 
-
     def test_35_two_router_waypoint_no_tenant_external_addr(self):
         test = WaypointTest(self.routers[0].addresses[0],
                             self.routers[1].addresses[2],
@@ -467,7 +432,6 @@
             test.logger.dump()
         self.assertEqual(None, test.error)
 
-
     def test_36_two_router_waypoint_external_addr(self):
         test = WaypointTest(self.routers[0].addresses[1],
                             self.routers[1].addresses[2],
@@ -536,7 +500,7 @@
 
     def timeout(self):
         self.error = "Timeout Expired: n_sent=%d n_rcvd=%d n_accepted=%d n_receiver_opened=%d n_sender_opened=%d" %\
-        (self.n_sent, self.n_rcvd, self.n_accepted, self.n_receiver_opened, self.n_sender_opened)
+            (self.n_sent, self.n_rcvd, self.n_accepted, self.n_receiver_opened, self.n_sender_opened)
         self.sender_conn.close()
         self.receiver_conn.close()
         self.lookup_conn.close()
@@ -624,7 +588,7 @@
 
     def timeout(self):
         self.error = "Timeout Expired: n_sent=%d n_rcvd=%d n_accepted=%d n_agent_reads=%d n_receiver_opened=%d n_sender_opened=%d" %\
-        (self.n_sent, self.n_rcvd, self.n_accepted, self.n_agent_reads, self.n_receiver_opened, self.n_sender_opened)
+            (self.n_sent, self.n_rcvd, self.n_accepted, self.n_agent_reads, self.n_receiver_opened, self.n_sender_opened)
         self.sender_conn.close()
         self.receiver_conn.close()
         self.lookup_conn.close()
@@ -761,7 +725,6 @@
         else:
             self.first_receiver = event.container.create_receiver(self.first_conn, self.first_address)
 
-
     def on_start(self, event):
         self.timer          = event.reactor.schedule(TIMEOUT, TestTimeout(self))
         self.first_conn     = event.container.connect(self.first_host)
@@ -770,7 +733,6 @@
         self.reply_receiver = event.container.create_receiver(self.lookup_conn, dynamic=True)
         self.agent_sender   = event.container.create_sender(self.lookup_conn, "$management")
 
-
     def on_link_opening(self, event):
         if event.sender:
             self.second_sender = event.sender
@@ -797,7 +759,6 @@
                 self.fail("Incorrect address on incoming receiver: got %s, expected %s" %
                           (event.receiver.remote_target.address, self.second_address))
 
-
     def on_link_opened(self, event):
         if event.receiver:
             event.receiver.flow(self.count)
@@ -880,7 +841,7 @@
         self.timer.cancel()
         if self.error:
             self.outs = "n_sent=%d n_rcvd=%d n_thru=%d n_waypoint_rcvd=%d" % (self.n_sent, self.n_rcvd, self.n_thru, self.n_waypoint_rcvd)
-        print (self.outs)
+        print(self.outs)
 
     def send_client(self):
         while self.first_sender.credit > 0 and self.n_sent < self.count:
diff --git a/tests/system_tests_multi_tenancy_policy.py b/tests/system_tests_multi_tenancy_policy.py
index 4fe4e01..72c4647 100644
--- a/tests/system_tests_multi_tenancy_policy.py
+++ b/tests/system_tests_multi_tenancy_policy.py
@@ -71,7 +71,7 @@
                                    'allowDynamicSource': 'true'
                                }
                            }
-                          }),
+                           }),
                 connection
             ]
 
@@ -89,7 +89,6 @@
         cls.routers[0].wait_router_connected('B')
         cls.routers[1].wait_router_connected('A')
 
-
     def test_01_one_router_targeted_sender_no_tenant(self):
         test = MessageTransferTest(self.routers[0].addresses[0],
                                    self.routers[0].addresses[0],
@@ -100,7 +99,6 @@
         test.run()
         self.assertEqual(None, test.error)
 
-
     def test_02_one_router_targeted_sender_tenant_on_sender(self):
         test = MessageTransferTest(self.routers[0].addresses[1],
                                    self.routers[0].addresses[0],
@@ -111,7 +109,6 @@
         test.run()
         self.assertEqual(None, test.error)
 
-
     def test_03_one_router_targeted_sender_tenant_on_receiver(self):
         test = MessageTransferTest(self.routers[0].addresses[0],
                                    self.routers[0].addresses[1],
@@ -122,7 +119,6 @@
         test.run()
         self.assertEqual(None, test.error)
 
-
     def test_04_one_router_targeted_sender_tenant_on_both(self):
         test = MessageTransferTest(self.routers[0].addresses[1],
                                    self.routers[0].addresses[1],
@@ -133,7 +129,6 @@
         test.run()
         self.assertEqual(None, test.error)
 
-
     def test_05_two_router_targeted_sender_no_tenant(self):
         test = MessageTransferTest(self.routers[0].addresses[0],
                                    self.routers[1].addresses[0],
@@ -144,7 +139,6 @@
         test.run()
         self.assertEqual(None, test.error)
 
-
     def test_06_two_router_targeted_sender_tenant_on_sender(self):
         test = MessageTransferTest(self.routers[0].addresses[1],
                                    self.routers[1].addresses[0],
@@ -155,7 +149,6 @@
         test.run()
         self.assertEqual(None, test.error)
 
-
     def test_07_two_router_targeted_sender_tenant_on_receiver(self):
         test = MessageTransferTest(self.routers[0].addresses[0],
                                    self.routers[1].addresses[1],
@@ -166,7 +159,6 @@
         test.run()
         self.assertEqual(None, test.error)
 
-
     def test_08_two_router_targeted_sender_tenant_on_both(self):
         test = MessageTransferTest(self.routers[0].addresses[1],
                                    self.routers[1].addresses[1],
@@ -177,7 +169,6 @@
         test.run()
         self.assertEqual(None, test.error)
 
-
     def test_09_one_router_anonymous_sender_no_tenant(self):
         test = MessageTransferAnonTest(self.routers[0].addresses[0],
                                        self.routers[0].addresses[0],
@@ -188,7 +179,6 @@
         test.run()
         self.assertEqual(None, test.error)
 
-
     def test_10_one_router_anonymous_sender_tenant_on_sender(self):
         test = MessageTransferAnonTest(self.routers[0].addresses[1],
                                        self.routers[0].addresses[0],
@@ -199,7 +189,6 @@
         test.run()
         self.assertEqual(None, test.error)
 
-
     def test_11_one_router_anonymous_sender_tenant_on_receiver(self):
         test = MessageTransferAnonTest(self.routers[0].addresses[0],
                                        self.routers[0].addresses[1],
@@ -210,7 +199,6 @@
         test.run()
         self.assertEqual(None, test.error)
 
-
     def test_12_one_router_anonymous_sender_tenant_on_both(self):
         test = MessageTransferAnonTest(self.routers[0].addresses[1],
                                        self.routers[0].addresses[1],
@@ -221,7 +209,6 @@
         test.run()
         self.assertEqual(None, test.error)
 
-
     def test_13_two_router_anonymous_sender_no_tenant(self):
         test = MessageTransferAnonTest(self.routers[0].addresses[0],
                                        self.routers[1].addresses[0],
@@ -232,7 +219,6 @@
         test.run()
         self.assertEqual(None, test.error)
 
-
     def test_14_two_router_anonymous_sender_tenant_on_sender(self):
         test = MessageTransferAnonTest(self.routers[0].addresses[1],
                                        self.routers[1].addresses[0],
@@ -243,7 +229,6 @@
         test.run()
         self.assertEqual(None, test.error)
 
-
     def test_15_two_router_anonymous_sender_tenant_on_receiver(self):
         test = MessageTransferAnonTest(self.routers[0].addresses[0],
                                        self.routers[1].addresses[1],
@@ -254,7 +239,6 @@
         test.run()
         self.assertEqual(None, test.error)
 
-
     def test_16_two_router_anonymous_sender_tenant_on_both(self):
         test = MessageTransferAnonTest(self.routers[0].addresses[1],
                                        self.routers[1].addresses[1],
@@ -265,7 +249,6 @@
         test.run()
         self.assertEqual(None, test.error)
 
-
     def test_17_one_router_link_route_targeted(self):
         test = LinkRouteTest(self.routers[0].addresses[1],
                              self.routers[0].addresses[2],
@@ -276,7 +259,6 @@
         test.run()
         self.assertEqual(None, test.error)
 
-
     def test_18_one_router_link_route_targeted_no_tenant(self):
         test = LinkRouteTest(self.routers[0].addresses[0],
                              self.routers[0].addresses[2],
@@ -287,7 +269,6 @@
         test.run()
         self.assertEqual(None, test.error)
 
-
     def test_19_one_router_link_route_dynamic(self):
         test = LinkRouteTest(self.routers[0].addresses[1],
                              self.routers[0].addresses[2],
@@ -298,7 +279,6 @@
         test.run()
         self.assertEqual(None, test.error)
 
-
     def test_20_one_router_link_route_dynamic_no_tenant(self):
         test = LinkRouteTest(self.routers[0].addresses[0],
                              self.routers[0].addresses[2],
@@ -309,7 +289,6 @@
         test.run()
         self.assertEqual(None, test.error)
 
-
     def test_21_two_router_link_route_targeted(self):
         test = LinkRouteTest(self.routers[0].addresses[1],
                              self.routers[1].addresses[2],
@@ -320,7 +299,6 @@
         test.run()
         self.assertEqual(None, test.error)
 
-
     def test_22_two_router_link_route_targeted_no_tenant(self):
         test = LinkRouteTest(self.routers[0].addresses[0],
                              self.routers[1].addresses[2],
@@ -331,7 +309,6 @@
         test.run()
         self.assertEqual(None, test.error)
 
-
     def test_23_two_router_link_route_dynamic(self):
         test = LinkRouteTest(self.routers[0].addresses[1],
                              self.routers[1].addresses[2],
@@ -342,7 +319,6 @@
         test.run()
         self.assertEqual(None, test.error)
 
-
     def test_24_two_router_link_route_dynamic_no_tenant(self):
         test = LinkRouteTest(self.routers[0].addresses[0],
                              self.routers[1].addresses[2],
@@ -353,7 +329,6 @@
         test.run()
         self.assertEqual(None, test.error)
 
-
     def test_25_one_router_anonymous_sender_non_mobile(self):
         test = MessageTransferAnonTest(self.routers[0].addresses[1],
                                        self.routers[0].addresses[0],
@@ -364,7 +339,6 @@
         test.run()
         self.assertEqual(None, test.error)
 
-
     def test_26_one_router_targeted_sender_non_mobile(self):
         test = MessageTransferTest(self.routers[0].addresses[1],
                                    self.routers[0].addresses[0],
@@ -375,7 +349,6 @@
         test.run()
         self.assertEqual(None, test.error)
 
-
     def test_27_two_router_anonymous_sender_non_mobile(self):
         test = MessageTransferAnonTest(self.routers[0].addresses[1],
                                        self.routers[1].addresses[0],
@@ -386,7 +359,6 @@
         test.run()
         self.assertEqual(None, test.error)
 
-
     def test_28_two_router_targeted_sender_non_mobile(self):
         test = MessageTransferTest(self.routers[0].addresses[1],
                                    self.routers[1].addresses[0],
@@ -397,7 +369,6 @@
         test.run()
         self.assertEqual(None, test.error)
 
-
     def test_29_one_router_waypoint_no_tenant(self):
         test = WaypointTest(self.routers[0].addresses[0],
                             self.routers[0].addresses[2],
@@ -409,7 +380,6 @@
             test.logger.dump()
         self.assertEqual(None, test.error)
 
-
     def test_30_one_router_waypoint(self):
         test = WaypointTest(self.routers[0].addresses[1],
                             self.routers[0].addresses[2],
@@ -421,7 +391,6 @@
             test.logger.dump()
         self.assertEqual(None, test.error)
 
-
     def test_31_two_router_waypoint_no_tenant(self):
         test = WaypointTest(self.routers[0].addresses[0],
                             self.routers[1].addresses[2],
@@ -433,7 +402,6 @@
             test.logger.dump()
         self.assertEqual(None, test.error)
 
-
     def test_32_two_router_waypoint(self):
         test = WaypointTest(self.routers[0].addresses[1],
                             self.routers[1].addresses[2],
@@ -445,7 +413,6 @@
             test.logger.dump()
         self.assertEqual(None, test.error)
 
-
     def test_33_one_router_waypoint_no_tenant_external_addr(self):
         test = WaypointTest(self.routers[0].addresses[0],
                             self.routers[0].addresses[2],
@@ -458,7 +425,6 @@
             test.logger.dump()
         self.assertEqual(None, test.error)
 
-
     def test_34_one_router_waypoint_external_addr(self):
         test = WaypointTest(self.routers[0].addresses[1],
                             self.routers[0].addresses[2],
@@ -471,7 +437,6 @@
             test.logger.dump()
         self.assertEqual(None, test.error)
 
-
     def test_35_two_router_waypoint_no_tenant_external_addr(self):
         test = WaypointTest(self.routers[0].addresses[0],
                             self.routers[1].addresses[2],
@@ -484,7 +449,6 @@
             test.logger.dump()
         self.assertEqual(None, test.error)
 
-
     def test_36_two_router_waypoint_external_addr(self):
         test = WaypointTest(self.routers[0].addresses[1],
                             self.routers[1].addresses[2],
@@ -553,7 +517,7 @@
 
     def timeout(self):
         self.error = "Timeout Expired: n_sent=%d n_rcvd=%d n_accepted=%d n_receiver_opened=%d n_sender_opened=%d" %\
-        (self.n_sent, self.n_rcvd, self.n_accepted, self.n_receiver_opened, self.n_sender_opened)
+            (self.n_sent, self.n_rcvd, self.n_accepted, self.n_receiver_opened, self.n_sender_opened)
         self.sender_conn.close()
         self.receiver_conn.close()
         self.lookup_conn.close()
@@ -641,7 +605,7 @@
 
     def timeout(self):
         self.error = "Timeout Expired: n_sent=%d n_rcvd=%d n_accepted=%d n_agent_reads=%d n_receiver_opened=%d n_sender_opened=%d" %\
-        (self.n_sent, self.n_rcvd, self.n_accepted, self.n_agent_reads, self.n_receiver_opened, self.n_sender_opened)
+            (self.n_sent, self.n_rcvd, self.n_accepted, self.n_agent_reads, self.n_receiver_opened, self.n_sender_opened)
         self.sender_conn.close()
         self.receiver_conn.close()
         self.lookup_conn.close()
@@ -778,7 +742,6 @@
         else:
             self.first_receiver = event.container.create_receiver(self.first_conn, self.first_address)
 
-
     def on_start(self, event):
         self.timer          = event.reactor.schedule(TIMEOUT, TestTimeout(self))
         self.first_conn     = event.container.connect(self.first_host)
@@ -787,7 +750,6 @@
         self.reply_receiver = event.container.create_receiver(self.lookup_conn, dynamic=True)
         self.agent_sender   = event.container.create_sender(self.lookup_conn, "$management")
 
-
     def on_link_opening(self, event):
         if event.sender:
             self.second_sender = event.sender
@@ -814,7 +776,6 @@
                 self.fail("Incorrect address on incoming receiver: got %s, expected %s" %
                           (event.receiver.remote_target.address, self.second_address))
 
-
     def on_link_opened(self, event):
         if event.receiver:
             event.receiver.flow(self.count)
@@ -897,7 +858,7 @@
         self.first_conn.close()
         self.timer.cancel()
         self.outs = "n_sent=%d n_rcvd=%d n_thru=%d n_waypoint_rcvd=%d" % (self.n_sent, self.n_rcvd, self.n_thru, self.n_waypoint_rcvd)
-        print (self.outs)
+        print(self.outs)
 
     def send_client(self):
         while self.first_sender.credit > 0 and self.n_sent < self.count:
@@ -975,6 +936,5 @@
         container.run()
 
 
-
 if __name__ == '__main__':
     unittest.main(main_module())
diff --git a/tests/system_tests_multicast.py b/tests/system_tests_multicast.py
index e4d397a..f84551b 100644
--- a/tests/system_tests_multicast.py
+++ b/tests/system_tests_multicast.py
@@ -39,15 +39,15 @@
 from system_test import AsyncTestSender, AsyncTestReceiver, TestCase, Qdrouterd, main_module, TIMEOUT, TestTimeout, unittest
 
 
-MAX_FRAME=1023
-LINK_CAPACITY=250
-W_THREADS=2
+MAX_FRAME = 1023
+LINK_CAPACITY = 250
+W_THREADS = 2
 LARGE_PAYLOAD = ("X" * MAX_FRAME) * 19
 
 # check for leaks of the following entities
-ALLOC_STATS=["qd_message_t",
-             "qd_buffer_t",
-             "qdr_delivery_t"]
+ALLOC_STATS = ["qd_message_t",
+               "qd_buffer_t",
+               "qdr_delivery_t"]
 
 
 class MulticastLinearTest(TestCase):
@@ -152,28 +152,28 @@
              'receivers':   ['R-EA1-1', 'R-EA1-2'],
              'subscribers': 2,
              'remotes':     0
-            },
+             },
             # Interior router INT_A:
             {'router':      cls.INT_A,
              'senders':     ['S-INT_A-1'],
              'receivers':   ['R-INT_A-1', 'R-INT_A-2'],
              'subscribers': 3,
              'remotes':     1,
-            },
+             },
             # Interior router INT_B:
             {'router':      cls.INT_B,
              'senders':     [],
              'receivers':   ['R-INT_B-1', 'R-INT_B-2'],
              'subscribers': 3,
              'remotes':     1,
-            },
+             },
             # edge router EB1
             {'router':      cls.EB1,
              'senders':     [],
              'receivers':   ['R-EB1-1', 'R-EB1-2'],
              'subscribers': 2,
              'remotes':     0,
-            }
+             }
         ]
 
     def _get_alloc_stats(self, router, stats):
@@ -445,6 +445,7 @@
     """
     All messages are sent presettled
     """
+
     def apply(self, link):
         link.snd_settle_mode = Link.SND_SETTLED
         link.rcv_settle_mode = Link.RCV_FIRST
@@ -454,6 +455,7 @@
     """
     Messages may be sent unsettled or settled
     """
+
     def apply(self, link):
         link.snd_settle_mode = Link.SND_MIXED
         link.rcv_settle_mode = Link.RCV_FIRST
@@ -463,6 +465,7 @@
     """
     Messages will be sent unsettled
     """
+
     def apply(self, link):
         link.snd_settle_mode = Link.SND_UNSETTLED
         link.rcv_settle_mode = Link.RCV_FIRST
@@ -473,6 +476,7 @@
     Messages will be sent unsettled and the receiver will wait for sender to
     settle first.
     """
+
     def apply(self, link):
         link.snd_settle_mode = Link.SND_UNSETTLED
         link.rcv_settle_mode = Link.RCV_SECOND
@@ -482,6 +486,7 @@
     """
     Common multicast boilerplate code
     """
+
     def __init__(self, config, count, body, topic=None, **handler_kwargs):
         super(MulticastBase, self).__init__(**handler_kwargs)
         self.msg_count = count
@@ -490,8 +495,8 @@
         self.body = body
 
         # totals
-        self.n_senders = 0;
-        self.n_receivers = 0;
+        self.n_senders = 0
+        self.n_receivers = 0
         self.n_sent = 0
         self.n_received = 0
         self.n_settled = 0
@@ -639,6 +644,7 @@
     Test multicast forwarding for presettled transfers.
     Verifies that all messages are settled by the sender
     """
+
     def __init__(self, config, count, body, settlement_mode):
         # use a large prefetch to prevent drops
         super(MulticastPresettled, self).__init__(config,
@@ -715,6 +721,7 @@
     """
     Spontaneously close a receiver or connection on message received
     """
+
     def __init__(self, config, count, drop_clients, detach, body):
         super(MulticastPresettledRxFail, self).__init__(config, count, body, SendPresettled())
         self.drop_clients = drop_clients
@@ -749,8 +756,9 @@
     Send count messages per sender, senders wait for terminal outcome from
     receivers before settling
     """
+
     def __init__(self, config, count, body, outcomes=None):
-        pfetch = int((count + 1)/2)
+        pfetch = int((count + 1) / 2)
         super(MulticastUnsettled3Ack, self).__init__(config,
                                                      count,
                                                      body,
@@ -830,6 +838,7 @@
     """
     Sender sends unsettled, the receiver sets outcome and immediately settles
     """
+
     def __init__(self, config, count, body, outcomes=None):
         super(MulticastUnsettled1Ack, self).__init__(config,
                                                      count,
@@ -866,6 +875,7 @@
     """
     Spontaneously close a receiver or connection on message received
     """
+
     def __init__(self, config, count, drop_clients, detach, body):
         super(MulticastUnsettledRxFail, self).__init__(config, count, body)
         self.drop_clients = drop_clients
@@ -899,6 +909,7 @@
     """
     Try 3 Ack, but with a bunch of user Message Annotations (why not?)
     """
+
     def __init__(self, config, count, body, outcomes=None):
         super(MulticastUnsettled3AckMA, self).__init__(config,
                                                        count,
@@ -907,11 +918,11 @@
         self._huge_ma = {
             "my-key": "my-data",
             "my-other-key": "my-other-data",
-            "my-map": { "my-map-key1": "X",
-                        "my-map-key2": 0x12,
-                        "my-map-key3": "+0123456789" * 101,
-                        "my-map-list": [i for i in range(97)]
-            },
+            "my-map": {"my-map-key1": "X",
+                       "my-map-key2": 0x12,
+                       "my-map-key3": "+0123456789" * 101,
+                       "my-map-list": [i for i in range(97)]
+                       },
             "my-last-key": "so long, folks!"
         }
 
@@ -938,6 +949,7 @@
     the sending link has opened a short timer is started.  It is expected that
     on_sendable() is NOT invoked before the timer expires.
     """
+
     def __init__(self, address, target=None, timeout=2, **handler_kwargs):
         super(MulticastCreditBlocked, self).__init__(**handler_kwargs)
         self.target = target
diff --git a/tests/system_tests_one_router.py b/tests/system_tests_one_router.py
index 27269d1..a75396d 100644
--- a/tests/system_tests_one_router.py
+++ b/tests/system_tests_one_router.py
@@ -31,7 +31,8 @@
 from proton import Terminus
 from proton import Data, symbol
 from qpid_dispatch.management.client import Node, BadRequestStatus
-import os, json
+import os
+import json
 from subprocess import PIPE, STDOUT
 from time import sleep
 from test_broker import FakeBroker
@@ -67,7 +68,7 @@
             out = mgmt.create("org.apache.qpid.dispatch.connector",
                               {"host": "0.0.0.0",
                                "port": "77777",
-                               "role":"inter-router"})
+                               "role": "inter-router"})
         except Exception as e:
             if "BadRequestStatus: role='standalone' not allowed to connect to or accept connections from other routers." in str(e):
                 test_pass = True
@@ -86,7 +87,7 @@
             out = mgmt.create("org.apache.qpid.dispatch.listener",
                               {"host": "0.0.0.0",
                                "port": "77777",
-                               "role":"edge",
+                               "role": "edge",
                                "authenticatePeer": "no"})
         except Exception as e:
             if "BadRequestStatus: role='standalone' not allowed to connect to or accept connections from other routers." in str(e):
@@ -94,7 +95,6 @@
 
         self.assertTrue(test_pass)
 
-
     def test_51_add_interrouter_listener_to_standalone_router(self):
         """
         This test tries to add an inter-router listener to a standalone router.
@@ -107,7 +107,7 @@
             out = mgmt.create("org.apache.qpid.dispatch.listener",
                               {"host": "0.0.0.0",
                                "port": "77777",
-                               "role":"inter-router",
+                               "role": "inter-router",
                                "authenticatePeer": "no"})
         except Exception as e:
             if "BadRequestStatus: role='standalone' not allowed to connect to or accept connections from other routers." in str(e):
@@ -115,6 +115,7 @@
 
         self.assertTrue(test_pass)
 
+
 class EdgeRouterQdManageTest(TestCase):
     @classmethod
     def setUpClass(cls):
@@ -139,7 +140,7 @@
             out = mgmt.create("org.apache.qpid.dispatch.connector",
                               {"host": "0.0.0.0",
                                "port": "77777",
-                               "role":"inter-router"})
+                               "role": "inter-router"})
         except Exception as e:
             if "BadRequestStatus: role='inter-router' only allowed with router mode='interior'" in str(e):
                 test_pass = True
@@ -158,7 +159,7 @@
             out = mgmt.create("org.apache.qpid.dispatch.listener",
                               {"host": "0.0.0.0",
                                "port": "77777",
-                               "role":"edge",
+                               "role": "edge",
                                "authenticatePeer": "no"})
         except Exception as e:
             if "BadRequestStatus: role='edge' only allowed with router mode='interior'" in str(e):
@@ -178,7 +179,7 @@
             out = mgmt.create("org.apache.qpid.dispatch.listener",
                               {"host": "0.0.0.0",
                                "port": "77777",
-                               "role":"inter-router",
+                               "role": "inter-router",
                                "authenticatePeer": "no"})
         except Exception as e:
             if "BadRequestStatus: role='inter-router' only allowed with router mode='interior'" in str(e):
@@ -186,6 +187,7 @@
 
         self.assertTrue(test_pass)
 
+
 class StandaloneEdgeRouterConfigTest(TestCase):
     """
     Try to start the router with bad config and make sure the router
@@ -253,7 +255,6 @@
         # fast and find that nothing has yet been written to the .out files.
         sleep(3)
 
-
     def test_48_router_in_error(self):
         test_pass = False
         with open(self.router.outfile + '.out', 'r') as out_file:
@@ -357,7 +358,6 @@
             raise Exception(out if out else str(e))
         return out
 
-
     def test_01_listen_error(self):
         # Make sure a router exits if a initial listener fails, doesn't hang.
         config = Qdrouterd.Config([
@@ -366,131 +366,123 @@
         r = Qdrouterd(name="expect_fail", config=config, wait=False)
         self.assertEqual(1, r.wait())
 
-
-    def test_02_pre_settled ( self ):
+    def test_02_pre_settled(self):
         addr = self.address + '/closest/' + str(OneRouterTest.closest_count)
         OneRouterTest.closest_count += 1
-        test = PreSettled ( addr, n_messages = 10 )
-        test.run ( )
-        self.assertEqual ( None, test.error )
+        test = PreSettled(addr, n_messages=10)
+        test.run()
+        self.assertEqual(None, test.error)
 
-
-    def test_03_multicast_unsettled ( self ) :
+    def test_03_multicast_unsettled(self) :
         n_receivers = 5
         addr = self.address + '/multicast/1'
-        test = MulticastUnsettled ( addr, n_messages = 10, n_receivers = 5 )
-        test.run ( )
-        self.assertEqual ( None, test.error )
+        test = MulticastUnsettled(addr, n_messages=10, n_receivers=5)
+        test.run()
+        self.assertEqual(None, test.error)
 
     # DISPATCH-1277. This test will fail with a policy but without the fix in policy_local.py
     # In other words, if the max-frame-size was 2147483647 and not 16384, this
     # test would fail.
-    def test_04_disposition_returns_to_closed_connection ( self ) :
+    def test_04_disposition_returns_to_closed_connection(self) :
         addr = self.address + '/closest/' + str(OneRouterTest.closest_count)
         OneRouterTest.closest_count += 1
-        test = DispositionReturnsToClosedConnection ( addr, n_messages = 100 )
-        test.run ( )
-        self.assertEqual ( None, test.error )
+        test = DispositionReturnsToClosedConnection(addr, n_messages=100)
+        test.run()
+        self.assertEqual(None, test.error)
 
-
-    def test_05_sender_settles_first ( self ) :
+    def test_05_sender_settles_first(self) :
         addr = self.address + '/closest/' + str(OneRouterTest.closest_count)
         OneRouterTest.closest_count += 1
-        test = SenderSettlesFirst ( addr, n_messages = 100 )
-        test.run ( )
-        self.assertEqual ( None, test.error )
+        test = SenderSettlesFirst(addr, n_messages=100)
+        test.run()
+        self.assertEqual(None, test.error)
 
-
-    def test_06_propagated_disposition ( self ) :
+    def test_06_propagated_disposition(self) :
         addr = self.address + '/closest/' + str(OneRouterTest.closest_count)
         OneRouterTest.closest_count += 1
-        test = PropagatedDisposition ( addr, n_messages = 10 )
-        test.run ( )
-        self.assertEqual ( None, test.error )
+        test = PropagatedDisposition(addr, n_messages=10)
+        test.run()
+        self.assertEqual(None, test.error)
 
-
-    def test_07_unsettled_undeliverable ( self ) :
+    def test_07_unsettled_undeliverable(self) :
         addr = self.address + '/closest/' + str(OneRouterTest.closest_count)
         OneRouterTest.closest_count += 1
-        test = UsettledUndeliverable ( addr, n_messages = 10 )
-        test.run ( )
-        self.assertEqual ( None, test.error )
+        test = UsettledUndeliverable(addr, n_messages=10)
+        test.run()
+        self.assertEqual(None, test.error)
 
-
-    def test_08_three_ack ( self ) :
+    def test_08_three_ack(self) :
         addr = self.address + '/closest/' + str(OneRouterTest.closest_count)
         OneRouterTest.closest_count += 1
-        test = ThreeAck ( addr, n_messages = 10 )
-        test.run ( )
-        self.assertEqual ( None, test.error )
+        test = ThreeAck(addr, n_messages=10)
+        test.run()
+        self.assertEqual(None, test.error)
 
-
-    def test_09_message_annotations ( self ) :
+    def test_09_message_annotations(self) :
         addr = self.address + '/closest/' + str(OneRouterTest.closest_count)
         OneRouterTest.closest_count += 1
-        test = MessageAnnotations ( addr, n_messages = 10 )
-        test.run ( )
-        self.assertEqual ( None, test.error )
-
+        test = MessageAnnotations(addr, n_messages=10)
+        test.run()
+        self.assertEqual(None, test.error)
 
     # Tests stripping of ingress and egress annotations.
     # There is a property in qdrouter.json called stripAnnotations with possible values of ["in", "out", "both", "no"]
     # The default for stripAnnotations is "both" (which means strip annotations on both ingress and egress)
     # This test will test the stripAnnotations = no option - meaning no annotations must be stripped.
     # We will send in a custom annotation and make sure that we get back 3 annotations on the received message
+
     def test_10_strip_message_annotations_custom(self):
         addr = self.no_strip_addr + "/strip_message_annotations_no_custom/1"
         OneRouterTest.closest_count += 1
-        test = StripMessageAnnotationsCustom ( addr, n_messages = 10 )
-        test.run ( )
-        self.assertEqual ( None, test.error )
-
-
-    # stripAnnotations property is set to "no" 
-    def test_11_test_strip_message_annotations_no(self):
-        addr = self.no_strip_addr + "/strip_message_annotations_no/1"
-        test = StripMessageAnnotationsNo ( addr, n_messages = 10 )
-        test.run ( )
-        self.assertEqual ( None, test.error )
-
+        test = StripMessageAnnotationsCustom(addr, n_messages=10)
+        test.run()
+        self.assertEqual(None, test.error)
 
     # stripAnnotations property is set to "no"
+
+    def test_11_test_strip_message_annotations_no(self):
+        addr = self.no_strip_addr + "/strip_message_annotations_no/1"
+        test = StripMessageAnnotationsNo(addr, n_messages=10)
+        test.run()
+        self.assertEqual(None, test.error)
+
+    # stripAnnotations property is set to "no"
+
     def test_12_test_strip_message_annotations_no_add_trace(self):
         addr = self.no_strip_addr + "/strip_message_annotations_no_add_trace/1"
-        test = StripMessageAnnotationsNoAddTrace ( addr, n_messages = 10 )
-        test.run ( )
-        self.assertEqual ( None, test.error )
+        test = StripMessageAnnotationsNoAddTrace(addr, n_messages=10)
+        test.run()
+        self.assertEqual(None, test.error)
 
-
-    # Dont send any pre-existing ingress or trace annotations. Make sure that there 
+    # Dont send any pre-existing ingress or trace annotations. Make sure that there
     # are no outgoing message annotations stripAnnotations property is set to "both".
     # Custom annotations, however, are not stripped.
+
     def test_13_test_strip_message_annotations_both(self):
         addr = self.both_strip_addr + "/strip_message_annotations_both/1"
-        test = StripMessageAnnotationsBoth ( addr, n_messages = 10 )
-        test.run ( )
-        self.assertEqual ( None, test.error )
+        test = StripMessageAnnotationsBoth(addr, n_messages=10)
+        test.run()
+        self.assertEqual(None, test.error)
 
-
-    # Dont send any pre-existing ingress or trace annotations. Make sure that there 
+    # Dont send any pre-existing ingress or trace annotations. Make sure that there
     # are no outgoing message annotations
     # stripAnnotations property is set to "out"
+
     def test_14_test_strip_message_annotations_out(self):
         addr = self.out_strip_addr + "/strip_message_annotations_out/1"
-        test = StripMessageAnnotationsOut ( addr, n_messages = 10 )
-        test.run ( )
-        self.assertEqual ( None, test.error )
+        test = StripMessageAnnotationsOut(addr, n_messages=10)
+        test.run()
+        self.assertEqual(None, test.error)
 
-
-    # Send in pre-existing trace and ingress and annotations and make sure 
+    # Send in pre-existing trace and ingress and annotations and make sure
     # that they are not in the outgoing annotations.
     # stripAnnotations property is set to "in"
+
     def test_15_test_strip_message_annotations_in(self):
         addr = self.in_strip_addr + "/strip_message_annotations_in/1"
-        test = StripMessageAnnotationsIn ( addr, n_messages = 10 )
-        test.run ( )
-        self.assertEqual ( None, test.error )
-
+        test = StripMessageAnnotationsIn(addr, n_messages=10)
+        test.run()
+        self.assertEqual(None, test.error)
 
     def test_16_management(self):
         test = ManagementTest(self.address)
@@ -779,7 +771,7 @@
         bd = msg.body
         if isinstance(bd, dict) and 'results' in bd and 'attributeNames' in bd:
             ##
-            ## This is a query response
+            # This is a query response
             ##
             response = []
             anames = bd['attributeNames']
@@ -832,6 +824,7 @@
         self._conn = event.container.connect(self._addr,
                                              offered_capabilities=self._caps,
                                              desired_capabilities=self._caps)
+
     def timeout(self):
         self.error = "Timeout Expired: connection failed"
         if self._conn:
@@ -918,7 +911,7 @@
             self.error = "Expected %d calls to on_released but got %d" % (self.num_messages - self.recv_messages_max, self.num_released)
 
     def on_accepted(self, event):
-        self.num_accepted +=1
+        self.num_accepted += 1
 
     def on_message(self, event):
         if event.receiver == self.receiver:
@@ -971,7 +964,7 @@
         if self.n_received_a + self.n_received_b + self.n_received_c == self.num_messages\
                 and self.n_received_b != 0 and self.n_received_c != 0:
             self.rx_set.sort()
-            #print self.rx_set
+            # print self.rx_set
             all_messages_received = True
             for i in range(self.num_messages):
                 if not i == self.rx_set[i]:
@@ -1216,7 +1209,7 @@
             request = Message()
             request.address = "amqp:/_local/$management"
             request.reply_to = self.receiver.remote_source.address
-            request.properties = {u'type':u'org.amqp.management', u'name':u'self', u'operation':u'GET-OPERATIONS'}
+            request.properties = {u'type': u'org.amqp.management', u'name': u'self', u'operation': u'GET-OPERATIONS'}
             self.sender.send(request)
 
     def run(self):
@@ -1303,7 +1296,6 @@
         Container(self).run()
 
 
-
 class CustomTimeout(object):
     def __init__(self, parent):
         self.parent = parent
@@ -1418,12 +1410,12 @@
         Container(self).run()
 
 
-class PreSettled ( MessagingHandler ) :
-    def __init__ ( self,
-                   addr,
-                   n_messages
+class PreSettled (MessagingHandler) :
+    def __init__(self,
+                 addr,
+                 n_messages
                  ) :
-        super ( PreSettled, self ) . __init__ ( prefetch = n_messages )
+        super(PreSettled, self) . __init__(prefetch=n_messages)
         self.addr       = addr
         self.n_messages = n_messages
 
@@ -1434,46 +1426,40 @@
         self.error      = None
         self.test_timer = None
 
-
-    def run ( self ) :
+    def run(self) :
         Container(self).run()
 
-
-    def bail ( self, travail ) :
+    def bail(self, travail) :
         self.error = travail
-        self.send_conn.close ( )
-        self.recv_conn.close ( )
-        self.test_timer.cancel ( )
+        self.send_conn.close()
+        self.recv_conn.close()
+        self.test_timer.cancel()
 
+    def timeout(self):
+        self.bail("Timeout Expired: %d messages received, %d expected." % (self.n_received, self.n_messages))
 
-    def timeout ( self ):
-        self.bail ( "Timeout Expired: %d messages received, %d expected." % (self.n_received, self.n_messages) )
-
-
-    def on_start ( self, event ):
-        self.send_conn = event.container.connect ( self.addr )
-        self.recv_conn = event.container.connect ( self.addr )
-        self.sender   = event.container.create_sender   ( self.send_conn, self.addr )
-        self.receiver = event.container.create_receiver ( self.send_conn, self.addr )
-        self.receiver.flow ( self.n_messages )
+    def on_start(self, event):
+        self.send_conn = event.container.connect(self.addr)
+        self.recv_conn = event.container.connect(self.addr)
+        self.sender   = event.container.create_sender(self.send_conn, self.addr)
+        self.receiver = event.container.create_receiver(self.send_conn, self.addr)
+        self.receiver.flow(self.n_messages)
         self.test_timer = event.reactor.schedule(TIMEOUT, TestTimeout(self))
 
-
-    def on_sendable ( self, event ) :
+    def on_sendable(self, event) :
         while self.n_sent < self.n_messages :
             if event.sender.credit < 1 :
                 break
-            msg = Message ( body = self.n_sent )
+            msg = Message(body=self.n_sent)
             # Presettle the delivery.
-            dlv = self.sender.send ( msg )
+            dlv = self.sender.send(msg)
             dlv.settle()
             self.n_sent += 1
 
-
-    def on_message ( self, event ) :
+    def on_message(self, event) :
         self.n_received += 1
         if self.n_received >= self.n_messages :
-            self.bail ( None )
+            self.bail(None)
 
 
 class PresettledCustomTimeout(object):
@@ -1497,7 +1483,7 @@
         # and so all the remaining messages are still in the
         # proton buffers.
         deliveries_ingress_diff = ingress_delivery_count - self.parent.begin_ingress_count
-        if  deliveries_ingress_diff + deliveries_dropped_diff > self.parent.n_messages:
+        if deliveries_ingress_diff + deliveries_dropped_diff > self.parent.n_messages:
             self.parent.bail(None)
         else:
             self.parent.bail("Messages sent to the router is %d, "
@@ -1508,7 +1494,7 @@
 
 class DroppedPresettledTest(MessagingHandler):
     def __init__(self, addr, n_messages, begin_ingress_count, begin_dropped_presettled_count):
-        super (DroppedPresettledTest, self).__init__()
+        super(DroppedPresettledTest, self).__init__()
         self.addr = addr
         self.n_messages = n_messages
         self.sender = None
@@ -1529,7 +1515,7 @@
         for i in range(8192):
             self.msg_str += self.str1
 
-    def run (self):
+    def run(self):
         Container(self).run()
 
     def bail(self, travail):
@@ -1543,7 +1529,7 @@
         self.bail("Timeout Expired: %d messages received, %d expected." %
                   (self.n_received, self.n_messages))
 
-    def on_start (self, event):
+    def on_start(self, event):
         self.sender_conn = event.container.connect(self.addr)
         self.recv_conn = event.container.connect(self.addr)
         self.receiver = event.container.create_receiver(self.recv_conn,
@@ -1561,7 +1547,7 @@
                           body={'sequence': (self.n_sent + 1),
                                 'msg_str': self.msg_str})
             # Presettle the delivery.
-            dlv = self.sender.send (msg)
+            dlv = self.sender.send(msg)
             dlv.settle()
             self.n_sent += 1
 
@@ -1578,50 +1564,46 @@
             # by the router.
             self.custom_timer = event.reactor.schedule(1, PresettledCustomTimeout(self))
 
-class MulticastUnsettled ( MessagingHandler ) :
-    def __init__ ( self,
-                   addr,
-                   n_messages,
-                   n_receivers
+
+class MulticastUnsettled (MessagingHandler) :
+    def __init__(self,
+                 addr,
+                 n_messages,
+                 n_receivers
                  ) :
-        super ( MulticastUnsettled, self ) . __init__ (auto_accept=False, prefetch=n_messages)
+        super(MulticastUnsettled, self) . __init__(auto_accept=False, prefetch=n_messages)
         self.addr        = addr
         self.n_messages  = n_messages
         self.n_receivers = n_receivers
 
         self.sender     = None
-        self.receivers  = list ( )
+        self.receivers  = list()
         self.n_sent     = 0
-        self.n_received = list ( )
+        self.n_received = list()
         self.error      = None
         self.test_timer = None
         self.bailing    = False
 
-
-    def run ( self ) :
+    def run(self) :
         Container(self).run()
 
-
-    def bail ( self, travail ) :
+    def bail(self, travail) :
         self.bailing = True
         self.error = travail
-        self.send_conn.close ( )
-        self.recv_conn.close ( )
-        self.test_timer.cancel ( )
+        self.send_conn.close()
+        self.recv_conn.close()
+        self.test_timer.cancel()
 
+    def timeout(self):
+        self.bail("Timeout Expired")
 
-    def timeout ( self ):
-        self.bail ( "Timeout Expired" )
-
-
-    def on_start ( self, event ):
-        self.recv_conn = event.container.connect ( self.addr )
-        for i in range ( self.n_receivers ) :
-            rcvr = event.container.create_receiver ( self.recv_conn, self.addr, name = "receiver_" + str(i) )
-            rcvr.flow ( self.n_messages )
+    def on_start(self, event):
+        self.recv_conn = event.container.connect(self.addr)
+        for i in range(self.n_receivers) :
+            rcvr = event.container.create_receiver(self.recv_conn, self.addr, name="receiver_" + str(i))
+            rcvr.flow(self.n_messages)
         self.test_timer = event.reactor.schedule(TIMEOUT, TestTimeout(self))
 
-
     def on_link_opened(self, event):
         if event.receiver:
             self.receivers.append(event.receiver)
@@ -1631,85 +1613,77 @@
                 self.send_conn = event.container.connect(self.addr)
                 self.sender = event.container.create_sender(self.send_conn, self.addr)
 
-    def on_sendable ( self, event ) :
+    def on_sendable(self, event) :
         while self.n_sent < self.n_messages :
             if event.sender.credit < 1 :
                 break
-            for i in range ( self.n_messages ) :
-                msg = Message ( body = i )
+            for i in range(self.n_messages) :
+                msg = Message(body=i)
                 # The sender does not settle, but the
                 # receivers will..
-                self.sender.send ( msg )
+                self.sender.send(msg)
                 self.n_sent += 1
 
-    def on_message ( self, event ) :
+    def on_message(self, event) :
         if self.bailing :
             return
         event.delivery.settle()
-        for i in range ( self.n_receivers ) :
-            if event.receiver == self.receivers [ i ] :
+        for i in range(self.n_receivers) :
+            if event.receiver == self.receivers[i] :
                 # Body conetnts of the messages count from 0 ... n,
                 # so the contents of this message should be same as
                 # the current number of messages received by this receiver.
-                if self.n_received [ i ] != event.message.body :
-                    self.bail ( "out of order or missed message: receiver %d got %d instead of %d" %
-                                ( i, event.message.body, self.n_received [ i ] )
+                if self.n_received[i] != event.message.body :
+                    self.bail("out of order or missed message: receiver %d got %d instead of %d" %
+                              (i, event.message.body, self.n_received[i])
                               )
                     return
-                self.n_received [ i ] += 1
-                self.check_n_received ( )
+                self.n_received[i] += 1
+                self.check_n_received()
 
-
-    def check_n_received ( self ) :
-        for i in range ( self.n_receivers ) :
-            if self.n_received [ i ] < self.n_messages :
+    def check_n_received(self) :
+        for i in range(self.n_receivers) :
+            if self.n_received[i] < self.n_messages :
                 return
         # All messages have been received by all receivers.
-        self.bail ( None )
+        self.bail(None)
 
 
+class DispositionReturnsToClosedConnection (MessagingHandler) :
 
-
-class DispositionReturnsToClosedConnection ( MessagingHandler ) :
-
-    def __init__ ( self,
-                   addr,
-                   n_messages
+    def __init__(self,
+                 addr,
+                 n_messages
                  ) :
-        super ( DispositionReturnsToClosedConnection, self ) . __init__ ( prefetch = n_messages )
+        super(DispositionReturnsToClosedConnection, self) . __init__(prefetch=n_messages)
         self.addr       = addr
         self.n_messages = n_messages
 
         self.n_sent     = 0
         self.n_received = 0
 
-
-    def run ( self ) :
+    def run(self) :
         Container(self).run()
 
-
-    def bail ( self, travail ) :
+    def bail(self, travail) :
         self.bailing = True
-        self.test_timer.cancel ( )
+        self.test_timer.cancel()
         self.error = travail
         if self.send_conn :
-            self.send_conn.close ( )
-        self.recv_conn.close ( )
+            self.send_conn.close()
+        self.recv_conn.close()
 
+    def timeout(self) :
+        self.bail("Timeout Expired")
 
-    def timeout ( self ) :
-        self.bail ( "Timeout Expired" )
-
-
-    def on_start ( self, event ):
-        self.send_conn = event.container.connect ( self.addr )
-        self.recv_conn = event.container.connect ( self.addr )
-        self.sender   = event.container.create_sender   ( self.send_conn, self.addr )
-        self.receiver = event.container.create_receiver ( self.recv_conn, self.addr )
+    def on_start(self, event):
+        self.send_conn = event.container.connect(self.addr)
+        self.recv_conn = event.container.connect(self.addr)
+        self.sender   = event.container.create_sender(self.send_conn, self.addr)
+        self.receiver = event.container.create_receiver(self.recv_conn, self.addr)
         self.test_timer = event.reactor.schedule(TIMEOUT, TestTimeout(self))
 
-
-    def on_sendable ( self, event ) :
+    def on_sendable(self, event) :
 
         if not self.send_conn :
             return
@@ -1717,40 +1691,37 @@
         while self.n_sent < self.n_messages :
             if event.sender.credit < 1 :
                 break
-            msg = Message ( body = self.n_sent )
-            self.sender.send ( msg )
+            msg = Message(body=self.n_sent)
+            self.sender.send(msg)
             self.n_sent += 1
 
-        # Immediately upon finishing sending all the messages, the 
+        # Immediately upon finishing sending all the messages, the
         # sender closes its connection, so that when the dispositions
         # try to come back they will find no one who cares.
-        # The only problem I can directly detect here is a test 
+        # The only problem I can directly detect here is a test
         # timeout. And, indirectly, we are making sure that the router
         # does not blow sky high.
         if self.n_sent >= self.n_messages :
             self.send_conn.close()
             self.send_conn = None
 
-
-    # On the receiver side, we keep accepting and settling 
+    # On the receiver side, we keep accepting and settling
     # messages, tragically unaware that no one cares.
-    def on_message ( self, event ) :
-        event.delivery.update ( Delivery.ACCEPTED )
-        event.delivery.settle ( )
+
+    def on_message(self, event) :
+        event.delivery.update(Delivery.ACCEPTED)
+        event.delivery.settle()
         self.n_received += 1
         if self.n_received >= self.n_messages :
-            self.bail ( None )
+            self.bail(None)
 
 
-
-
-
-class SenderSettlesFirst ( MessagingHandler ) :
-    def __init__ ( self,
-                   addr,
-                   n_messages
+class SenderSettlesFirst (MessagingHandler) :
+    def __init__(self,
+                 addr,
+                 n_messages
                  ) :
-        super ( SenderSettlesFirst, self ) . __init__ ( prefetch = n_messages )
+        super(SenderSettlesFirst, self) . __init__(prefetch=n_messages)
         self.addr        = addr
         self.n_messages  = n_messages
 
@@ -1760,58 +1731,50 @@
         self.n_sent     = 0
         self.n_received = 0
 
-
-    def run ( self ) :
+    def run(self) :
         Container(self).run()
 
-
-    def bail ( self, travail ) :
+    def bail(self, travail) :
         self.bailing = True
         self.error = travail
-        self.send_conn.close ( )
-        self.recv_conn.close ( )
-        self.test_timer.cancel ( )
+        self.send_conn.close()
+        self.recv_conn.close()
+        self.test_timer.cancel()
 
+    def timeout(self):
+        self.bail("Timeout Expired")
 
-    def timeout ( self ):
-        self.bail ( "Timeout Expired" )
+    def on_start(self, event):
+        self.send_conn = event.container.connect(self.addr)
+        self.recv_conn = event.container.connect(self.addr)
 
-
-    def on_start ( self, event ):
-        self.send_conn = event.container.connect ( self.addr )
-        self.recv_conn = event.container.connect ( self.addr )
-
-        self.sender      = event.container.create_sender   ( self.send_conn, self.addr )
-        self.receiver    = event.container.create_receiver ( self.recv_conn, self.addr )
+        self.sender      = event.container.create_sender(self.send_conn, self.addr)
+        self.receiver    = event.container.create_receiver(self.recv_conn, self.addr)
         self.test_timer  = event.reactor.schedule(TIMEOUT, TestTimeout(self))
 
-
-    def on_sendable ( self, event ) :
+    def on_sendable(self, event) :
         while self.n_sent < self.n_messages :
             if event.sender.credit < 1 :
                 break
-            msg = Message ( body = self.n_sent )
+            msg = Message(body=self.n_sent)
             # Settle the delivery immediately after sending.
-            dlv = self.sender.send ( msg )
+            dlv = self.sender.send(msg)
             dlv.settle()
             self.n_sent += 1
 
-
-    def on_message ( self, event ) :
+    def on_message(self, event) :
         self.n_received += 1
-        event.delivery.settle ( )
+        event.delivery.settle()
         if self.n_received >= self.n_messages :
-            self.bail ( None )
+            self.bail(None)
 
 
-
-
-class PropagatedDisposition ( MessagingHandler ) :
-    def __init__ ( self,
-                   addr,
-                   n_messages
+class PropagatedDisposition (MessagingHandler) :
+    def __init__(self,
+                 addr,
+                 n_messages
                  ) :
-        super ( PropagatedDisposition, self ) . __init__ ( prefetch = n_messages )
+        super(PropagatedDisposition, self) . __init__(prefetch=n_messages)
         self.addr        = addr
         self.n_messages  = n_messages
 
@@ -1823,90 +1786,81 @@
         self.n_accepted = 0
         self.bailing    = False
 
-
-    def run ( self ) :
+    def run(self) :
         Container(self).run()
 
-
-    def bail ( self, travail ) :
+    def bail(self, travail) :
         self.bailing = True
         self.error = travail
-        self.send_conn.close ( )
-        self.recv_conn.close ( )
-        self.test_timer.cancel ( )
+        self.send_conn.close()
+        self.recv_conn.close()
+        self.test_timer.cancel()
 
+    def timeout(self):
+        self.bail("Timeout Expired")
 
-    def timeout ( self ):
-        self.bail ( "Timeout Expired" )
+    def on_start(self, event):
+        self.send_conn = event.container.connect(self.addr)
+        self.recv_conn = event.container.connect(self.addr)
 
-
-    def on_start ( self, event ):
-        self.send_conn = event.container.connect ( self.addr )
-        self.recv_conn = event.container.connect ( self.addr )
-
-        self.sender      = event.container.create_sender   ( self.send_conn, self.addr )
-        self.receiver    = event.container.create_receiver ( self.recv_conn, self.addr )
+        self.sender      = event.container.create_sender(self.send_conn, self.addr)
+        self.receiver    = event.container.create_receiver(self.recv_conn, self.addr)
         self.test_timer  = event.reactor.schedule(TIMEOUT, TestTimeout(self))
 
-
     # Sender Side ================================================
-    def on_sendable ( self, event ) :
+    def on_sendable(self, event) :
         if self.bailing :
             return
         while self.n_sent < self.n_messages :
             if event.sender.credit < 1 :
                 break
-            msg = Message ( body = self.n_sent )
-            dlv = self.sender.send ( msg )
+            msg = Message(body=self.n_sent)
+            dlv = self.sender.send(msg)
             if dlv.remote_state != 0 :
-                self.bail ( "remote state nonzero on send." )
+                self.bail("remote state nonzero on send.")
                 break
             if not dlv.pending :
-                self.bail ( "dlv not pending immediately after send." )
+                self.bail("dlv not pending immediately after send.")
                 break
 
             self.n_sent += 1
 
-
-    def on_accepted ( self, event ) :
+    def on_accepted(self, event) :
         if self.bailing :
             return
         dlv = event.delivery
         if dlv.pending :
-            self.bail ( "Delivery still pending after accepted." )
+            self.bail("Delivery still pending after accepted.")
             return
         if dlv.remote_state != Delivery.ACCEPTED :
-            self.bail ( "Delivery remote state is not ACCEPTED after accept." )
+            self.bail("Delivery remote state is not ACCEPTED after accept.")
             return
         self.n_accepted += 1
         if self.n_accepted >= self.n_messages :
             # Success!
-            self.bail ( None )
-
+            self.bail(None)
 
     # Receiver Side ================================================
-    def on_message ( self, event ) :
+    def on_message(self, event) :
         if self.bailing :
             return
         self.n_received += 1
         dlv = event.delivery
         if dlv.pending :
-            self.bail ( 'Delivery still pending at receiver.' )
+            self.bail('Delivery still pending at receiver.')
             return
         if dlv.local_state != 0 :
-            self.bail ( 'At receiver: delivery local state nonzero at receiver before accept.' )
+            self.bail('At receiver: delivery local state nonzero at receiver before accept.')
             return
-        dlv.update ( Delivery.ACCEPTED )
+        dlv.update(Delivery.ACCEPTED)
 
 
-
-
-class UsettledUndeliverable ( MessagingHandler ) :
-    def __init__ ( self,
-                   addr,
-                   n_messages
+class UsettledUndeliverable (MessagingHandler) :
+    def __init__(self,
+                 addr,
+                 n_messages
                  ) :
-        super ( UsettledUndeliverable, self ) . __init__ ( prefetch = n_messages )
+        super(UsettledUndeliverable, self) . __init__(prefetch=n_messages)
         self.addr        = addr
         self.n_messages  = n_messages
 
@@ -1916,52 +1870,44 @@
         self.n_received = 0
         self.bailing    = False
 
-
-    def run ( self ) :
+    def run(self) :
         Container(self).run()
 
-
-    def bail ( self, travail ) :
+    def bail(self, travail) :
         self.bailing = True
         self.error = travail
-        self.send_conn.close ( )
-        self.test_timer.cancel ( )
+        self.send_conn.close()
+        self.test_timer.cancel()
 
-
-    def timeout ( self ):
+    def timeout(self):
         if self.n_sent > 0 :
-            self.bail ( "Messages sent with no receiver." )
+            self.bail("Messages sent with no receiver.")
         else :
-            self.bail ( None )
+            self.bail(None)
 
-
-    def on_start ( self, event ):
-        self.send_conn = event.container.connect ( self.addr )
-        self.sender    = event.container.create_sender ( self.send_conn, self.addr )
+    def on_start(self, event):
+        self.send_conn = event.container.connect(self.addr)
+        self.sender    = event.container.create_sender(self.send_conn, self.addr)
         # Uh-oh. We are not creating a receiver!
         self.test_timer = event.reactor.schedule(TIMEOUT, TestTimeout(self))
 
-
-    def on_sendable ( self, event ) :
+    def on_sendable(self, event) :
         while self.n_sent < self.n_messages :
-            msg = Message ( body = self.n_sent )
-            dlv = self.sender.send ( msg )
+            msg = Message(body=self.n_sent)
+            dlv = self.sender.send(msg)
             dlv.settle()
             self.n_sent += 1
 
-
-    def on_message ( self, event ) :
+    def on_message(self, event) :
         self.n_received += 1
 
 
-
-
-class ThreeAck ( MessagingHandler ) :
-    def __init__ ( self,
-                   addr,
-                   n_messages
+class ThreeAck (MessagingHandler) :
+    def __init__(self,
+                 addr,
+                 n_messages
                  ) :
-        super ( ThreeAck, self ) . __init__ ( prefetch = n_messages )
+        super(ThreeAck, self) . __init__(prefetch=n_messages)
         self.addr        = addr
         self.n_messages  = n_messages
 
@@ -1974,51 +1920,45 @@
         self.bailing    = False
         self.tmp_dlv    = None
 
-
-    def run ( self ) :
+    def run(self) :
         Container(self).run()
 
-
-    def bail ( self, travail ) :
+    def bail(self, travail) :
         self.bailing = True
         self.error = travail
-        self.send_conn.close ( )
-        self.recv_conn.close ( )
-        self.test_timer.cancel ( )
+        self.send_conn.close()
+        self.recv_conn.close()
+        self.test_timer.cancel()
 
+    def timeout(self):
+        self.bail("Timeout Expired")
 
-    def timeout ( self ):
-        self.bail ( "Timeout Expired" )
+    def on_start(self, event):
+        self.send_conn = event.container.connect(self.addr)
+        self.recv_conn = event.container.connect(self.addr)
 
-
-    def on_start ( self, event ):
-        self.send_conn = event.container.connect ( self.addr )
-        self.recv_conn = event.container.connect ( self.addr )
-
-        self.sender      = event.container.create_sender   ( self.send_conn, self.addr )
-        self.receiver    = event.container.create_receiver ( self.recv_conn, self.addr )
+        self.sender      = event.container.create_sender(self.send_conn, self.addr)
+        self.receiver    = event.container.create_receiver(self.recv_conn, self.addr)
         self.test_timer = event.reactor.schedule(TIMEOUT, TestTimeout(self))
 
-
     # Sender Side ================================================
-    def on_sendable ( self, event ) :
+    def on_sendable(self, event) :
         if self.bailing :
             return
         while self.n_sent < self.n_messages :
             if event.sender.credit < 1 :
                 break
-            msg = Message ( body = self.n_sent )
-            dlv = self.sender.send ( msg )
+            msg = Message(body=self.n_sent)
+            dlv = self.sender.send(msg)
 
             self.n_sent += 1
 
-
-    def on_accepted ( self, event ) :
+    def on_accepted(self, event) :
         if self.bailing :
             return
         dlv = event.delivery
         if dlv.remote_state != Delivery.ACCEPTED :
-            self.bail ( "Delivery remote state is not ACCEPTED in on_accepted." )
+            self.bail("Delivery remote state is not ACCEPTED in on_accepted.")
             return
         # When sender knows that receiver has accepted, we settle.
         # That's two-ack.
@@ -2026,34 +1966,31 @@
         self.n_accepted += 1
         if self.n_accepted >= self.n_messages :
             # Success!
-            self.bail ( None )
-
+            self.bail(None)
 
     # Receiver Side ================================================
-    def on_message ( self, event ) :
+    def on_message(self, event) :
         if self.bailing :
             return
         dlv = event.delivery
-        dlv.update ( Delivery.ACCEPTED )
+        dlv.update(Delivery.ACCEPTED)
         if event.message.body != self.n_received :
-            self.bail ( "out-of-order message" )
+            self.bail("out-of-order message")
             return
         self.n_received += 1
-        if self.tmp_dlv == None :
+        if self.tmp_dlv is None :
             self.tmp_dlv = dlv
 
     # We have no way, on receiver side, of tracking when sender settles.
     # See PROTON-395 .
 
 
-
-
-class MessageAnnotations ( MessagingHandler ) :
-    def __init__ ( self,
-                   addr,
-                   n_messages
+class MessageAnnotations (MessagingHandler) :
+    def __init__(self,
+                 addr,
+                 n_messages
                  ) :
-        super ( MessageAnnotations, self ) . __init__ ( prefetch = n_messages )
+        super(MessageAnnotations, self) . __init__(prefetch=n_messages)
         self.addr        = addr
         self.n_messages  = n_messages
 
@@ -2064,114 +2001,106 @@
         self.n_received = 0
         self.bailing    = False
 
-
-    def run ( self ) :
+    def run(self) :
         Container(self).run()
 
-
-    def bail ( self, travail ) :
+    def bail(self, travail) :
         self.bailing = True
         self.error = travail
-        self.send_conn.close ( )
-        self.recv_conn.close ( )
-        self.test_timer.cancel ( )
+        self.send_conn.close()
+        self.recv_conn.close()
+        self.test_timer.cancel()
 
+    def timeout(self):
+        self.bail("Timeout Expired")
 
-    def timeout ( self ):
-        self.bail ( "Timeout Expired" )
+    def on_start(self, event):
+        self.send_conn = event.container.connect(self.addr)
+        self.recv_conn = event.container.connect(self.addr)
 
-
-    def on_start ( self, event ):
-        self.send_conn = event.container.connect ( self.addr )
-        self.recv_conn = event.container.connect ( self.addr )
-
-        self.sender      = event.container.create_sender   ( self.send_conn, self.addr )
-        self.receiver    = event.container.create_receiver ( self.recv_conn, self.addr )
+        self.sender      = event.container.create_sender(self.send_conn, self.addr)
+        self.receiver    = event.container.create_receiver(self.recv_conn, self.addr)
         self.test_timer  = event.reactor.schedule(TIMEOUT, TestTimeout(self))
 
-
-    def on_sendable ( self, event ) :
+    def on_sendable(self, event) :
 
         if event.sender.credit < 1 :
             return
         # No added annotations.
-        msg = Message ( body = self.n_sent )
+        msg = Message(body=self.n_sent)
         self.n_sent += 1
-        self.sender.send ( msg )
+        self.sender.send(msg)
 
         # Add an annotation.
-        msg = Message ( body = self.n_sent )
+        msg = Message(body=self.n_sent)
         self.n_sent += 1
-        msg.annotations = { 'x-opt-qd.ingress': 'i_changed_the_annotation' }
-        self.sender.send ( msg )
+        msg.annotations = {'x-opt-qd.ingress': 'i_changed_the_annotation'}
+        self.sender.send(msg)
 
         # Try to supply an invalid type for trace.
-        msg = Message ( body = self.n_sent )
+        msg = Message(body=self.n_sent)
         self.n_sent += 1
-        msg.annotations = { 'x-opt-qd.trace' : 45 }
-        self.sender.send ( msg )
+        msg.annotations = {'x-opt-qd.trace' : 45}
+        self.sender.send(msg)
 
         # Add a value to the trace list.
-        msg = Message ( body = self.n_sent )
+        msg = Message(body=self.n_sent)
         self.n_sent += 1
-        msg.annotations = { 'x-opt-qd.trace' : [ '0/first-hop' ] }
-        self.sender.send ( msg )
+        msg.annotations = {'x-opt-qd.trace' : ['0/first-hop']}
+        self.sender.send(msg)
 
-
-    def on_message ( self, event ) :
+    def on_message(self, event) :
         ingress_router_name = '0/QDR'
         self.n_received += 1
         if self.n_received >= self.n_messages :
-            self.bail ( None )
+            self.bail(None)
             return
 
         annotations = event.message.annotations
 
         if self.n_received == 1 :
-            if annotations [ 'x-opt-qd.ingress' ] != ingress_router_name :
-                self.bail ( 'Bad ingress router name on msg %d' % self.n_received )
+            if annotations['x-opt-qd.ingress'] != ingress_router_name :
+                self.bail('Bad ingress router name on msg %d' % self.n_received)
                 return
-            if annotations [ 'x-opt-qd.trace' ] != [ ingress_router_name ] :
-                self.bail ( 'Bad trace on msg %d.' % self.n_received )
+            if annotations['x-opt-qd.trace'] != [ingress_router_name] :
+                self.bail('Bad trace on msg %d.' % self.n_received)
                 return
 
         elif self.n_received == 2 :
-            if annotations [ 'x-opt-qd.ingress' ] != 'i_changed_the_annotation' :
-                self.bail ( 'Bad ingress router name on msg %d' % self.n_received )
+            if annotations['x-opt-qd.ingress'] != 'i_changed_the_annotation' :
+                self.bail('Bad ingress router name on msg %d' % self.n_received)
                 return
-            if annotations [ 'x-opt-qd.trace' ] != [ ingress_router_name ] :
-                self.bail ( 'Bad trace on msg %d .' % self.n_received )
+            if annotations['x-opt-qd.trace'] != [ingress_router_name] :
+                self.bail('Bad trace on msg %d .' % self.n_received)
                 return
 
         elif self.n_received == 3 :
             # The invalid type for trace has no effect.
-            if annotations [ 'x-opt-qd.ingress' ] != ingress_router_name :
-                self.bail ( 'Bad ingress router name on msg %d ' % self.n_received )
+            if annotations['x-opt-qd.ingress'] != ingress_router_name :
+                self.bail('Bad ingress router name on msg %d ' % self.n_received)
                 return
-            if annotations [ 'x-opt-qd.trace' ] != [ ingress_router_name ] :
-                self.bail ( 'Bad trace on msg %d' % self.n_received )
+            if annotations['x-opt-qd.trace'] != [ingress_router_name] :
+                self.bail('Bad trace on msg %d' % self.n_received)
                 return
 
         elif self.n_received == 4 :
-            if annotations [ 'x-opt-qd.ingress' ] != ingress_router_name :
-                self.bail ( 'Bad ingress router name on msg %d ' % self.n_received )
+            if annotations['x-opt-qd.ingress'] != ingress_router_name :
+                self.bail('Bad ingress router name on msg %d ' % self.n_received)
                 return
             # The sender prepended a value to the trace list.
-            if annotations [ 'x-opt-qd.trace' ] != [ '0/first-hop', ingress_router_name ] :
-                self.bail ( 'Bad trace on msg %d' % self.n_received )
+            if annotations['x-opt-qd.trace'] != ['0/first-hop', ingress_router_name] :
+                self.bail('Bad trace on msg %d' % self.n_received)
                 return
             # success
-            self.bail ( None )
+            self.bail(None)
 
 
-
-
-class StripMessageAnnotationsCustom ( MessagingHandler ) :
-    def __init__ ( self,
-                   addr,
-                   n_messages
+class StripMessageAnnotationsCustom (MessagingHandler) :
+    def __init__(self,
+                 addr,
+                 n_messages
                  ) :
-        super ( StripMessageAnnotationsCustom, self ) . __init__ ( prefetch = n_messages )
+        super(StripMessageAnnotationsCustom, self) . __init__(prefetch=n_messages)
         self.addr        = addr
         self.n_messages  = n_messages
 
@@ -2181,63 +2110,56 @@
         self.n_sent      = 0
         self.n_received  = 0
 
-
-    def run ( self ) :
+    def run(self) :
         Container(self).run()
 
-
-    def bail ( self, travail ) :
+    def bail(self, travail) :
         self.bailing = True
         self.error = travail
-        self.send_conn.close ( )
-        self.recv_conn.close ( )
-        self.test_timer.cancel ( )
+        self.send_conn.close()
+        self.recv_conn.close()
+        self.test_timer.cancel()
 
+    def timeout(self):
+        self.bail("Timeout Expired")
 
-    def timeout ( self ):
-        self.bail ( "Timeout Expired" )
+    def on_start(self, event):
+        self.send_conn = event.container.connect(self.addr)
+        self.recv_conn = event.container.connect(self.addr)
 
-
-    def on_start ( self, event ):
-        self.send_conn = event.container.connect ( self.addr )
-        self.recv_conn = event.container.connect ( self.addr )
-
-        self.sender      = event.container.create_sender   ( self.send_conn, self.addr )
-        self.receiver    = event.container.create_receiver ( self.recv_conn, self.addr )
+        self.sender      = event.container.create_sender(self.send_conn, self.addr)
+        self.receiver    = event.container.create_receiver(self.recv_conn, self.addr)
         self.test_timer = event.reactor.schedule(TIMEOUT, TestTimeout(self))
 
-
-    def on_sendable ( self, event ) :
+    def on_sendable(self, event) :
         while self.n_sent < self.n_messages :
             if event.sender.credit < 1 :
                 break
-            msg = Message ( body = self.n_sent )
+            msg = Message(body=self.n_sent)
             self.n_sent += 1
-            msg.annotations = { 'custom-annotation' : '1/Custom_Annotation' }
+            msg.annotations = {'custom-annotation' : '1/Custom_Annotation'}
 
-            self.sender.send ( msg )
+            self.sender.send(msg)
 
-
-    def on_message ( self, event ) :
+    def on_message(self, event) :
         self.n_received += 1
-        if not 'custom-annotation' in event.message.annotations :
-            self.bail ( 'custom annotation not found' )
+        if 'custom-annotation' not in event.message.annotations :
+            self.bail('custom annotation not found')
             return
-        if event.message.annotations [ 'custom-annotation'] != '1/Custom_Annotation' :
-            self.bail ( 'custom annotation bad value' )
+        if event.message.annotations['custom-annotation'] != '1/Custom_Annotation' :
+            self.bail('custom annotation bad value')
             return
         if self.n_received >= self.n_messages :
             # success
-            self.bail ( None )
+            self.bail(None)
 
 
-
-class StripMessageAnnotationsNo ( MessagingHandler ) :
-    def __init__ ( self,
-                   addr,
-                   n_messages
+class StripMessageAnnotationsNo (MessagingHandler) :
+    def __init__(self,
+                 addr,
+                 n_messages
                  ) :
-        super ( StripMessageAnnotationsNo, self ) . __init__ ( prefetch = n_messages )
+        super(StripMessageAnnotationsNo, self) . __init__(prefetch=n_messages)
         self.addr        = addr
         self.n_messages  = n_messages
 
@@ -2247,67 +2169,61 @@
         self.n_sent      = 0
         self.n_received  = 0
 
-
-    def run ( self ) :
+    def run(self) :
         Container(self).run()
 
-
-    def bail ( self, travail ) :
+    def bail(self, travail) :
         self.bailing = True
         self.error = travail
-        self.send_conn.close ( )
-        self.recv_conn.close ( )
-        self.test_timer.cancel ( )
+        self.send_conn.close()
+        self.recv_conn.close()
+        self.test_timer.cancel()
 
+    def timeout(self):
+        self.bail("Timeout Expired")
 
-    def timeout ( self ):
-        self.bail ( "Timeout Expired" )
+    def on_start(self, event):
+        self.send_conn = event.container.connect(self.addr)
+        self.recv_conn = event.container.connect(self.addr)
 
-
-    def on_start ( self, event ):
-        self.send_conn = event.container.connect ( self.addr )
-        self.recv_conn = event.container.connect ( self.addr )
-
-        self.sender      = event.container.create_sender   ( self.send_conn, self.addr )
-        self.receiver    = event.container.create_receiver ( self.recv_conn, self.addr )
+        self.sender      = event.container.create_sender(self.send_conn, self.addr)
+        self.receiver    = event.container.create_receiver(self.recv_conn, self.addr)
         self.test_timer = event.reactor.schedule(TIMEOUT, TestTimeout(self))
 
-    def on_sendable ( self, event ) :
+    def on_sendable(self, event) :
         while self.n_sent < self.n_messages :
             if event.sender.credit < 1 :
                 break
-            msg = Message ( body = self.n_sent )
+            msg = Message(body=self.n_sent)
             self.n_sent += 1
             # This test has no added annotations.
             # The receiver should get the expected standard annotations anyway,
             # because the address we are using has 'stripAnnotations' set to 'no'.
-            msg.annotations = { }
-            self.sender.send ( msg )
+            msg.annotations = {}
+            self.sender.send(msg)
 
-
-    def on_message ( self, event ) :
+    def on_message(self, event) :
         self.n_received += 1
 
-        if event.message.annotations [ 'x-opt-qd.ingress' ] != '0/QDR' :
-            self.bail ( "x-opt-qd.ingress annotation has been stripped!" )
+        if event.message.annotations['x-opt-qd.ingress'] != '0/QDR' :
+            self.bail("x-opt-qd.ingress annotation has been stripped!")
             return
 
-        if event.message.annotations [ 'x-opt-qd.trace' ] != [ '0/QDR' ] :
-            self.bail ( "x-opt-qd.trace annotations has been stripped!" )
+        if event.message.annotations['x-opt-qd.trace'] != ['0/QDR'] :
+            self.bail("x-opt-qd.trace annotations has been stripped!")
             return
 
         if self.n_received >= self.n_messages :
             # success
-            self.bail ( None )
+            self.bail(None)
 
 
-
-class StripMessageAnnotationsNoAddTrace ( MessagingHandler ) :
-    def __init__ ( self,
-                   addr,
-                   n_messages
+class StripMessageAnnotationsNoAddTrace (MessagingHandler) :
+    def __init__(self,
+                 addr,
+                 n_messages
                  ) :
-        super ( StripMessageAnnotationsNoAddTrace, self ) . __init__ ( prefetch = n_messages )
+        super(StripMessageAnnotationsNoAddTrace, self) . __init__(prefetch=n_messages)
         self.addr        = addr
         self.n_messages  = n_messages
 
@@ -2317,49 +2233,44 @@
         self.n_sent      = 0
         self.n_received  = 0
 
-
-    def run ( self ) :
+    def run(self) :
         Container(self).run()
 
-
-    def bail ( self, travail ) :
+    def bail(self, travail) :
         self.bailing = True
         self.error = travail
-        self.send_conn.close ( )
-        self.recv_conn.close ( )
-        self.test_timer.cancel ( )
+        self.send_conn.close()
+        self.recv_conn.close()
+        self.test_timer.cancel()
 
+    def timeout(self):
+        self.bail("Timeout Expired")
 
-    def timeout ( self ):
-        self.bail ( "Timeout Expired" )
+    def on_start(self, event):
+        self.send_conn = event.container.connect(self.addr)
+        self.recv_conn = event.container.connect(self.addr)
 
-
-    def on_start ( self, event ):
-        self.send_conn = event.container.connect ( self.addr )
-        self.recv_conn = event.container.connect ( self.addr )
-
-        self.sender      = event.container.create_sender   ( self.send_conn, self.addr )
-        self.receiver    = event.container.create_receiver ( self.recv_conn, self.addr )
+        self.sender      = event.container.create_sender(self.send_conn, self.addr)
+        self.receiver    = event.container.create_receiver(self.recv_conn, self.addr)
         self.test_timer = event.reactor.schedule(TIMEOUT, TestTimeout(self))
 
-    def on_sendable ( self, event ) :
+    def on_sendable(self, event) :
         while self.n_sent < self.n_messages :
             if event.sender.credit < 1 :
                 break
-            msg = Message ( body = self.n_sent )
+            msg = Message(body=self.n_sent)
             annotations = {'Canis_meus' : 'id_comedit',
                            'x-opt-qd.ingress': 'ingress-router',
                            'x-opt-qd.trace': ['0/QDR.1']
-            }
+                           }
             self.n_sent += 1
             # This test has no added annotations.
             # The receiver should get the expected standard annotations anyway,
             # because the address we are using has 'stripAnnotations' set to 'no'.
             msg.annotations = annotations
-            self.sender.send ( msg )
+            self.sender.send(msg)
 
-
-    def on_message ( self, event ) :
+    def on_message(self, event) :
         self.n_received += 1
 
         notes = event.message.annotations
@@ -2371,38 +2282,37 @@
         # No annotations should get stripped -- neither the
         # ones that the router adds, not the custome one that
         # I added.
-        if not 'x-opt-qd.ingress' in notes :
-            self.bail ( 'x-opt-qd.ingress annotation missing' )
+        if 'x-opt-qd.ingress' not in notes :
+            self.bail('x-opt-qd.ingress annotation missing')
             return
-        if not 'x-opt-qd.trace' in notes :
-            self.bail ( 'x-opt-qd.trace annotation missing' )
+        if 'x-opt-qd.trace' not in notes :
+            self.bail('x-opt-qd.trace annotation missing')
             return
-        if not 'Canis_meus' in notes :
-            self.bail ( 'Canis_meus annotation missing' )
+        if 'Canis_meus' not in notes :
+            self.bail('Canis_meus annotation missing')
             return
 
-        if notes [ 'x-opt-qd.ingress' ] != 'ingress-router' :
-            self.bail ( "x-opt-qd.ingress bad value" )
+        if notes['x-opt-qd.ingress'] != 'ingress-router' :
+            self.bail("x-opt-qd.ingress bad value")
             return
-        if notes [ 'x-opt-qd.trace' ] != ['0/QDR.1', '0/QDR'] :
-            self.bail ( "x-opt-qd.trace bad value" )
+        if notes['x-opt-qd.trace'] != ['0/QDR.1', '0/QDR'] :
+            self.bail("x-opt-qd.trace bad value")
             return
-        if notes [ 'Canis_meus' ] != 'id_comedit' :
-            self.bail ( "Canis_meus bad value" )
+        if notes['Canis_meus'] != 'id_comedit' :
+            self.bail("Canis_meus bad value")
             return
 
         if self.n_received >= self.n_messages :
             # success
-            self.bail ( None )
+            self.bail(None)
 
 
-
-class StripMessageAnnotationsBoth ( MessagingHandler ) :
-    def __init__ ( self,
-                   addr,
-                   n_messages
+class StripMessageAnnotationsBoth (MessagingHandler) :
+    def __init__(self,
+                 addr,
+                 n_messages
                  ) :
-        super ( StripMessageAnnotationsBoth, self ) . __init__ ( prefetch = n_messages )
+        super(StripMessageAnnotationsBoth, self) . __init__(prefetch=n_messages)
         self.addr        = addr
         self.n_messages  = n_messages
 
@@ -2412,80 +2322,74 @@
         self.n_sent      = 0
         self.n_received  = 0
 
-
-    def run ( self ) :
+    def run(self) :
         Container(self).run()
 
-
-    def bail ( self, travail ) :
+    def bail(self, travail) :
         self.bailing = True
         self.error = travail
-        self.send_conn.close ( )
-        self.recv_conn.close ( )
-        self.test_timer.cancel ( )
+        self.send_conn.close()
+        self.recv_conn.close()
+        self.test_timer.cancel()
 
+    def timeout(self):
+        self.bail("Timeout Expired")
 
-    def timeout ( self ):
-        self.bail ( "Timeout Expired" )
+    def on_start(self, event):
+        self.send_conn = event.container.connect(self.addr)
+        self.recv_conn = event.container.connect(self.addr)
 
-
-    def on_start ( self, event ):
-        self.send_conn = event.container.connect ( self.addr )
-        self.recv_conn = event.container.connect ( self.addr )
-
-        self.sender      = event.container.create_sender   ( self.send_conn, self.addr )
-        self.receiver    = event.container.create_receiver ( self.recv_conn, self.addr )
+        self.sender      = event.container.create_sender(self.send_conn, self.addr)
+        self.receiver    = event.container.create_receiver(self.recv_conn, self.addr)
         self.test_timer = event.reactor.schedule(TIMEOUT, TestTimeout(self))
 
-
-    def on_sendable ( self, event ) :
+    def on_sendable(self, event) :
         while self.n_sent < self.n_messages :
             if event.sender.credit < 1 :
                 break
-            msg = Message ( body = self.n_sent )
-            annotations = { 'Canis_meus' : 'id_comedit',
-                            'x-opt-qd.ingress': 'ingress-router',
-                            'x-opt-qd.trace': ['0/QDR.1'],
-                          }
+            msg = Message(body=self.n_sent)
+            annotations = {'Canis_meus': 'id_comedit',
+                           'x-opt-qd.ingress': 'ingress-router',
+                           'x-opt-qd.trace': ['0/QDR.1'],
+                           }
             self.n_sent += 1
             # This test has no added annotations.
             # The receiver should get the expected standard annotations anyway,
             # because the address we are using has 'stripAnnotations' set to 'no'.
             msg.annotations = annotations
-            self.sender.send ( msg )
+            self.sender.send(msg)
 
-
-    def on_message ( self, event ) :
+    def on_message(self, event) :
         self.n_received += 1
 
         # The annotations that the router adds should get stripped,
         # but not the custom one that I added.
         notes = event.message.annotations
         if 'x-opt-qd.ingress' in notes :
-            self.bail ( 'x-opt-qd.ingress annotation not stripped' )
+            self.bail('x-opt-qd.ingress annotation not stripped')
             return
         if 'x-opt-qd.trace' in notes :
-            self.bail ( 'x-opt-qd.trace annotation not stripped' )
+            self.bail('x-opt-qd.trace annotation not stripped')
             return
-        if not 'Canis_meus' in notes :
-            self.bail ( 'Canis_meus annotation missing' )
+        if 'Canis_meus' not in notes :
+            self.bail('Canis_meus annotation missing')
             return
 
-        if notes [ 'Canis_meus' ] != 'id_comedit' :
-            self.bail ( "Canis_meus bad value" )
+        if notes['Canis_meus'] != 'id_comedit' :
+            self.bail("Canis_meus bad value")
             return
 
         if self.n_received >= self.n_messages :
             # success
-            self.bail ( None )
+            self.bail(None)
 
 
-class StripMessageAnnotationsOut ( MessagingHandler ) :
-    def __init__ ( self,
-                   addr,
-                   n_messages
+class StripMessageAnnotationsOut (MessagingHandler) :
+    def __init__(self,
+                 addr,
+                 n_messages
                  ) :
-        super ( StripMessageAnnotationsOut, self ) . __init__ ( prefetch = n_messages )
+        super(StripMessageAnnotationsOut, self) . __init__(prefetch=n_messages)
         self.addr        = addr
         self.n_messages  = n_messages
 
@@ -2495,66 +2399,58 @@
         self.n_sent      = 0
         self.n_received  = 0
 
-
-    def run ( self ) :
+    def run(self) :
         Container(self).run()
 
-
-    def bail ( self, travail ) :
+    def bail(self, travail) :
         self.bailing = True
         self.error = travail
-        self.send_conn.close ( )
-        self.recv_conn.close ( )
-        self.test_timer.cancel ( )
+        self.send_conn.close()
+        self.recv_conn.close()
+        self.test_timer.cancel()
 
+    def timeout(self):
+        self.bail("Timeout Expired")
 
-    def timeout ( self ):
-        self.bail ( "Timeout Expired" )
+    def on_start(self, event):
+        self.send_conn = event.container.connect(self.addr)
+        self.recv_conn = event.container.connect(self.addr)
 
-
-    def on_start ( self, event ):
-        self.send_conn = event.container.connect ( self.addr )
-        self.recv_conn = event.container.connect ( self.addr )
-
-        self.sender      = event.container.create_sender   ( self.send_conn, self.addr )
-        self.receiver    = event.container.create_receiver ( self.recv_conn, self.addr )
+        self.sender      = event.container.create_sender(self.send_conn, self.addr)
+        self.receiver    = event.container.create_receiver(self.recv_conn, self.addr)
         self.test_timer  = event.reactor.schedule(TIMEOUT, TestTimeout(self))
 
-
-    def on_sendable ( self, event ) :
+    def on_sendable(self, event) :
         while self.n_sent < self.n_messages :
             if event.sender.credit < 1 :
                 break
-            msg = Message ( body = self.n_sent )
+            msg = Message(body=self.n_sent)
             self.n_sent += 1
             # This test has no added annotations.
             # The receiver should get the expected standard annotations anyway,
             # because the address we are using has 'stripAnnotations' set to 'no'.
-            self.sender.send ( msg )
+            self.sender.send(msg)
 
-
-    def on_message ( self, event ) :
+    def on_message(self, event) :
         self.n_received += 1
 
-        # The annotations that the router routinely adds 
+        # The annotations that the router routinely adds
         # should all get stripped,
-        if event.message.annotations != None :
-            self.bail ( "An annotation was not stripped in egress message." )
+        if event.message.annotations is not None :
+            self.bail("An annotation was not stripped in egress message.")
             return
 
         if self.n_received >= self.n_messages :
             # success
-            self.bail ( None )
+            self.bail(None)
 
 
-
-
-class StripMessageAnnotationsIn ( MessagingHandler ) :
-    def __init__ ( self,
-                   addr,
-                   n_messages
+class StripMessageAnnotationsIn (MessagingHandler) :
+    def __init__(self,
+                 addr,
+                 n_messages
                  ) :
-        super ( StripMessageAnnotationsIn, self ) . __init__ ( prefetch = n_messages )
+        super(StripMessageAnnotationsIn, self) . __init__(prefetch=n_messages)
         self.addr        = addr
         self.n_messages  = n_messages
 
@@ -2564,68 +2460,59 @@
         self.n_sent      = 0
         self.n_received  = 0
 
-
-    def run ( self ) :
+    def run(self) :
         Container(self).run()
 
-
-    def bail ( self, travail ) :
+    def bail(self, travail) :
         self.bailing = True
         self.error = travail
-        self.send_conn.close ( )
-        self.recv_conn.close ( )
-        self.test_timer.cancel ( )
+        self.send_conn.close()
+        self.recv_conn.close()
+        self.test_timer.cancel()
 
+    def timeout(self):
+        self.bail("Timeout Expired")
 
-    def timeout ( self ):
-        self.bail ( "Timeout Expired" )
+    def on_start(self, event):
+        self.send_conn = event.container.connect(self.addr)
+        self.recv_conn = event.container.connect(self.addr)
 
-
-    def on_start ( self, event ):
-        self.send_conn = event.container.connect ( self.addr )
-        self.recv_conn = event.container.connect ( self.addr )
-
-        self.sender      = event.container.create_sender   ( self.send_conn, self.addr )
-        self.receiver    = event.container.create_receiver ( self.recv_conn, self.addr )
+        self.sender      = event.container.create_sender(self.send_conn, self.addr)
+        self.receiver    = event.container.create_receiver(self.recv_conn, self.addr)
         self.test_timer  = event.reactor.schedule(TIMEOUT, TestTimeout(self))
 
-
-    def on_sendable ( self, event ) :
+    def on_sendable(self, event) :
         while self.n_sent < self.n_messages :
             if event.sender.credit < 1 :
                 break
-            msg = Message ( body = self.n_sent )
+            msg = Message(body=self.n_sent)
             # Attach some standard annotations to the message.
             # These are ingress annotations, and should get stripped.
             # These annotation-keys will then get values assigned by
             # the router.
             notes = {'x-opt-qd.ingress': 'ingress-router', 'x-opt-qd.trace': ['0/QDR.1']}
-            self.sender.send ( msg )
+            self.sender.send(msg)
             self.n_sent += 1
 
-
-    def on_message ( self, event ) :
+    def on_message(self, event) :
         self.n_received += 1
 
-        if event.message.annotations [ 'x-opt-qd.ingress' ] == 'ingress-router' :
-            self.bail ( "x-opt-qd.ingress value was not stripped." )
+        if event.message.annotations['x-opt-qd.ingress'] == 'ingress-router' :
+            self.bail("x-opt-qd.ingress value was not stripped.")
             return
 
-        if event.message.annotations [ 'x-opt-qd.trace' ] == ['0/QDR.1'] :
-            self.bail ( "x-opt-qd.trace value was not stripped." )
+        if event.message.annotations['x-opt-qd.trace'] == ['0/QDR.1'] :
+            self.bail("x-opt-qd.trace value was not stripped.")
             return
 
         if self.n_received >= self.n_messages :
             # success
-            self.bail ( None )
-
-
-
-
+            self.bail(None)
 
 
 HELLO_WORLD = "Hello World!"
 
+
 class SndSettleModeTest(MessagingHandler):
     def __init__(self, address):
         super(SndSettleModeTest, self).__init__()
@@ -2706,6 +2593,7 @@
     def run(self):
         Container(self).run()
 
+
 class UnavailableBase(MessagingHandler):
     def __init__(self, address):
         super(UnavailableBase, self).__init__()
@@ -2741,6 +2629,7 @@
     def run(self):
         Container(self).run()
 
+
 class UnavailableSender(UnavailableBase):
     def __init__(self, address):
         super(UnavailableSender, self).__init__(address)
@@ -2753,6 +2642,7 @@
         # "Node not found"
         self.sender = event.container.create_sender(self.conn, self.dest, name=self.link_name)
 
+
 class UnavailableReceiver(UnavailableBase):
     def __init__(self, address):
         super(UnavailableReceiver, self).__init__(address)
@@ -2765,11 +2655,13 @@
         # "Node not found"
         self.receiver = event.container.create_receiver(self.conn, self.dest, name=self.link_name)
 
+
 class MulticastUnsettledTest(MessagingHandler):
     """
     Send N unsettled multicast messages to 2 receivers.  Ensure sender is
     notified of settlement and disposition changes from the receivers.
     """
+
     def __init__(self, address):
         super(MulticastUnsettledTest, self).__init__(auto_accept=False, prefetch=0)
         self.address = address
@@ -2798,7 +2690,7 @@
                                                          options=AtLeastOnce())
         self.receiver2 = event.container.create_receiver(self.conn, self.dest,
                                                          name="B",
-                                                         options=AtLeastOnce());
+                                                         options=AtLeastOnce())
         self.receiver1.flow(self.count)
         self.receiver2.flow(self.count)
 
@@ -3081,7 +2973,6 @@
         # No deliveries were sent on any link yet, so the lastDlv must be "-"
         self.reactor = event.reactor
 
-
     def on_link_opened(self, event):
         # Schedule the UptimeLastDlvChecker only after the sender and
         # receiver links have been opened on those connections. This
@@ -3097,7 +2988,6 @@
                 self.custom_timer = event.reactor.schedule(1, UptimeLastDlvChecker(self, uptime=1,
                                                                                    lastDlv=None))
 
-
     def run(self):
         container = Container(self)
         container.container_id = self.container_id
@@ -3160,18 +3050,17 @@
         self.n_modified = 0
         self.node_modified_at_start = 0
 
-    def get_modified_deliveries ( self ) :
+    def get_modified_deliveries(self) :
         local_node = Node.connect(self.address, timeout=TIMEOUT)
         outs = local_node.query(type='org.apache.qpid.dispatch.router')
         pos = outs.attribute_names.index("modifiedDeliveries")
         results = outs.results[0]
-        n_modified_deliveries = results [ pos ]
+        n_modified_deliveries = results[pos]
         return n_modified_deliveries
 
-
     def check_if_done(self):
         if self.n_received == self.accept and self.n_released == self.count - self.accept and self.n_modified == self.accept:
-            node_modified_now = self.get_modified_deliveries ( )
+            node_modified_now = self.get_modified_deliveries()
             this_test_modified_deliveries = node_modified_now - self.node_modified_at_start
             if this_test_modified_deliveries == self.accept:
                 self.timer.cancel()
@@ -3188,7 +3077,7 @@
         self.sender    = event.container.create_sender(self.conn, self.dest)
         self.receiver  = event.container.create_receiver(self.conn, self.dest, name="A")
         self.receiver.flow(self.accept)
-        self.node_modified_at_start = self.get_modified_deliveries ( )
+        self.node_modified_at_start = self.get_modified_deliveries()
 
     def on_sendable(self, event):
         for i in range(self.count - self.n_sent):
@@ -3384,8 +3273,6 @@
         Container(self).run()
 
 
-
-
 class PresettledOverflowTest(MessagingHandler):
     def __init__(self, address):
         super(PresettledOverflowTest, self).__init__(prefetch=0)
@@ -3457,7 +3344,7 @@
         self.reject_count_match = False
         self.rejects_at_start = 0
 
-    def count_rejects ( self ) :
+    def count_rejects(self) :
         local_node = Node.connect(self.address, timeout=TIMEOUT)
         outs = local_node.query(type='org.apache.qpid.dispatch.router')
         pos = outs.attribute_names.index("rejectedDeliveries")
@@ -3468,7 +3355,7 @@
         conn = event.container.connect(self.address)
         event.container.create_sender(conn, self.dest)
         event.container.create_receiver(conn, self.dest)
-        self.rejects_at_start = self.count_rejects ( )
+        self.rejects_at_start = self.count_rejects()
 
     def on_sendable(self, event):
         if not self.sent:
@@ -3479,7 +3366,7 @@
         if event.delivery.remote.condition.description == self.error_description \
                 and event.delivery.remote.condition.name == self.error_name:
             self.received_error = True
-        rejects_now = self.count_rejects ( )
+        rejects_now = self.count_rejects()
         rejects_for_this_test = rejects_now - self.rejects_at_start
         if rejects_for_this_test == 1:
             self.reject_count_match = True
@@ -3495,7 +3382,7 @@
 
 class UnsettledLargeMessageTest(MessagingHandler):
     def __init__(self, addr, n_messages):
-        super (UnsettledLargeMessageTest, self).__init__()
+        super(UnsettledLargeMessageTest, self).__init__()
         self.addr = addr
         self.n_messages = n_messages
         self.sender = None
@@ -3517,7 +3404,7 @@
         for i in range(16384):
             self.msg_str += self.str1
 
-    def run (self):
+    def run(self):
         Container(self).run()
 
     def check_if_done(self):
@@ -3537,7 +3424,7 @@
                                                   self.n_released,
                                                   self.n_modified)
 
-    def on_start (self, event):
+    def on_start(self, event):
         self.sender_conn = event.container.connect(self.addr)
         self.recv_conn = event.container.connect(self.addr)
         self.receiver = event.container.create_receiver(self.recv_conn,
@@ -3563,7 +3450,7 @@
                           body={'sequence': (self.n_sent + 1),
                                 'msg_str': self.msg_str})
             # Presettle the delivery.
-            self.sender.send (msg)
+            self.sender.send(msg)
             self.n_sent += 1
 
     def on_message(self, event):
@@ -3587,8 +3474,8 @@
         name = "test-router"
         OneRouterTest.listen_port = cls.tester.get_port()
         config = Qdrouterd.Config([
-            ('router', {'mode': 'standalone', 'id': 'QDR',  'defaultDistribution': 'unavailable'}),
-            ('listener', {'port': cls.tester.get_port() }),
+            ('router', {'mode': 'standalone', 'id': 'QDR', 'defaultDistribution': 'unavailable'}),
+            ('listener', {'port': cls.tester.get_port()}),
             ('address', {'prefix': 'closest', 'distribution': 'closest'}),
             ('address', {'prefix': 'balanced', 'distribution': 'balanced'}),
             ('address', {'prefix': 'multicast', 'distribution': 'multicast'}),
@@ -3665,6 +3552,7 @@
     Close the stalled rx connection, verify the remaining receivers get the
     message (Q2 holdoff disabled)
     """
+
     def __init__(self, router):
         super(Q2HoldoffDropTest, self).__init__(prefetch=0,
                                                 auto_accept=False,
@@ -3757,7 +3645,7 @@
 
     def on_message(self, event):
         self.n_rx += 1
-        if self.n_rx == 3: # first will arrive, second is blocked
+        if self.n_rx == 3:  # first will arrive, second is blocked
 
             class CloseTimer(Timeout):
                 def __init__(self, parent):
@@ -3802,6 +3690,7 @@
         transactional delivery.  At best we ensure that the router properly
         forwards the target capabilities and the declare message.
         """
+
         def __init__(self, url, container_id=None, **handler_kwargs):
             super(OneRouterTransactionalAttachTest.FakeTxnBroker,
                   self).__init__(url, container_id, **handler_kwargs)
@@ -3829,12 +3718,12 @@
                 super(OneRouterTransactionalAttachTest.FakeTxnBroker,
                       self).on_message(event)
 
-
     class TxSender(MessagingHandler, TransactionHandler):
         """
         Transactional publisher client.  The transaction will fail since the
         fake broker cannot declare the transaction properly
         """
+
         def __init__(self, url, messages=1):
             super(OneRouterTransactionalAttachTest.TxSender, self).__init__()
             self.url = Url(url)
@@ -3861,7 +3750,7 @@
             if self.transaction and self.sender.credit > 0 and self.sent < self.total:
                 seq = self.sent
                 self.sent -= 1
-                msg = Message(id=seq, body={'sequence':seq})
+                msg = Message(id=seq, body={'sequence': seq})
                 self.transaction.send(self.sender, msg)
                 self.transaction.commit()
                 self.transaction = None
@@ -3871,13 +3760,12 @@
             self.declare_failed = True
             self.conn.close()
 
-
     @classmethod
     def setUpClass(cls):
         super(OneRouterTransactionalAttachTest, cls).setUpClass()
         config = Qdrouterd.Config([
             ('router', {'mode': 'standalone', 'id': 'TxnRouter'}),
-            ('listener', {'port': cls.tester.get_port() }),
+            ('listener', {'port': cls.tester.get_port()}),
             ('connector', {'port': cls.tester.get_port(),
                            'role': 'route-container'}),
 
diff --git a/tests/system_tests_open_properties.py b/tests/system_tests_open_properties.py
index dd7fe66..c58779d 100644
--- a/tests/system_tests_open_properties.py
+++ b/tests/system_tests_open_properties.py
@@ -158,7 +158,7 @@
                                 "key4": False,
                                 "key5": None,
                                 "key6": ["x", False, "z", None]
-                    },
+                                },
                 },
                 "None": None,
                 "True": True,
@@ -183,7 +183,7 @@
                           'port': self.tester.get_port(),
                           'openProperties': op
                       })
-            ]
+                      ]
 
             router = self.tester.qdrouterd(name, Qdrouterd.Config(config),
                                            wait=client_class.wait)
@@ -204,6 +204,7 @@
     """
     Tests creating openProperties via qdmanage tool
     """
+
     def _valid_properties_check(self, client_class):
         """
         Test a few different valid property maps
@@ -234,7 +235,7 @@
                                 "key4": False,
                                 "key5": None,
                                 "key6": ["x", False, "z", None]
-                    },
+                                },
                 },
                 "None": None,
                 "True": True,
@@ -257,7 +258,7 @@
             config = [('router', {'id': name}),
                       ('listener', {
                           'port': self.tester.get_port()})
-            ]
+                      ]
 
             router = self.tester.qdrouterd(name,
                                            Qdrouterd.Config(config),
@@ -349,7 +350,7 @@
                           'port': self.tester.get_port(),
                           'openProperties': op
                       })
-            ]
+                      ]
 
             router = self.tester.qdrouterd(name, Qdrouterd.Config(config),
                                            wait=False,
@@ -357,7 +358,6 @@
             router.wait(timeout=TIMEOUT)
             self.assertTrue(self._find_in_output(router.outfile + '.out', err))
 
-
     def test_02_invalid_role_check(self):
         """
         Ensure that attempting to set openProperties on inter-router/edge
@@ -376,7 +376,7 @@
                                   "foo": "bar",
                               }
                           })
-                ]
+                          ]
 
                 router = self.tester.qdrouterd(name, Qdrouterd.Config(config),
                                                wait=False,
@@ -386,6 +386,5 @@
                 self.assertTrue(self._find_in_output(router.outfile + '.out', err))
 
 
-if __name__== '__main__':
+if __name__ == '__main__':
     unittest.main(main_module())
-
diff --git a/tests/system_tests_policy.py b/tests/system_tests_policy.py
index 326b63c..d4e2afa 100644
--- a/tests/system_tests_policy.py
+++ b/tests/system_tests_policy.py
@@ -23,7 +23,10 @@
 from __future__ import print_function
 
 import unittest as unittest
-import os, json, re, signal
+import os
+import json
+import re
+import signal
 import sys
 import time
 
@@ -38,6 +41,7 @@
 from qpid_dispatch_internal.compat import dict_iteritems
 from test_broker import FakeBroker
 
+
 class AbsoluteConnectionCountLimit(TestCase):
     """
     Verify that connections beyond the absolute limit are denied and counted
@@ -89,7 +93,7 @@
         except ConnectionException:
             denied = True
 
-        self.assertTrue(denied) # assert if connection that should not open did open
+        self.assertTrue(denied)  # assert if connection that should not open did open
 
         bc1.close()
         bc2.close()
@@ -98,6 +102,7 @@
         self.assertTrue(policystats[0]["connectionsDenied"] == 1)
         self.assertTrue(policystats[0]["totalDenials"] == 1)
 
+
 class LoadPolicyFromFolder(TestCase):
     """
     Verify that specifying a policy folder from the router conf file
@@ -112,10 +117,10 @@
         ipv6_enabled = is_ipv6_enabled()
 
         policy_config_path = os.path.join(DIR, 'policy-1')
-        replacements = {'{IPV6_LOOPBACK}':', ::1'}
+        replacements = {'{IPV6_LOOPBACK}': ', ::1'}
         for f in os.listdir(policy_config_path):
             if f.endswith(".json.in"):
-                with open(policy_config_path+"/"+f[:-3], 'w') as outfile:
+                with open(policy_config_path + "/" + f[:-3], 'w') as outfile:
                     with open(policy_config_path + "/" + f) as infile:
                         for line in infile:
                             for src, target in dict_iteritems(replacements):
@@ -336,12 +341,12 @@
         # To accomodate the file lag this test may retry reading the log file.
         verified = False
         for tries in range(5):
-            with  open('../setUpClass/SenderReceiverLimits.log', 'r') as router_log:
+            with open('../setUpClass/SenderReceiverLimits.log', 'r') as router_log:
                 log_lines = router_log.read().split("\n")
                 close_lines = [s for s in log_lines if "senders_denied=1, receivers_denied=1" in s]
                 verified = len(close_lines) == 1
             if verified:
-                break;
+                break
             print("system_tests_policy, SenderReceiverLimits, test_verify_z_connection_stats: delay to wait for log to be written")
             sys.stdout.flush()
             time.sleep(1)
@@ -539,7 +544,7 @@
         cls.routers[1].teardown()
 
     def test_01_router_links_allowed(self):
-        with  open(self.routers[0].outfile + '.out', 'r') as router_log:
+        with open(self.routers[0].outfile + '.out', 'r') as router_log:
             log_lines = router_log.read().split("\n")
             disallow_lines = [s for s in log_lines if "link disallowed" in s]
             self.assertTrue(len(disallow_lines) == 0, msg='Inter-router links should be allowed but some were blocked by policy.')
@@ -559,10 +564,10 @@
         ipv6_enabled = is_ipv6_enabled()
 
         policy_config_path = os.path.join(DIR, 'policy-1')
-        replacements = {'{IPV6_LOOPBACK}':', ::1'}
+        replacements = {'{IPV6_LOOPBACK}': ', ::1'}
         for f in os.listdir(policy_config_path):
             if f.endswith(".json.in"):
-                with open(policy_config_path+"/"+f[:-3], 'w') as outfile:
+                with open(policy_config_path + "/" + f[:-3], 'w') as outfile:
                     with open(policy_config_path + "/" + f) as infile:
                         for line in infile:
                             for src, target in dict_iteritems(replacements):
@@ -703,7 +708,6 @@
 }
 """
 
-
     def test_01_id_vs_hostname(self):
         # verify current vhost count
         rulesets = json.loads(self.run_qdmanage('query --type=vhost'))
@@ -737,7 +741,7 @@
         try:
             self.run_qdmanage('update --type=vhost --name=dispatch-918 --stdin',
                               input=self.both_policy())
-            self.assertTrue(False) # should not be able to update 'id'
+            self.assertTrue(False)  # should not be able to update 'id'
         except Exception as e:
             pass
 
@@ -779,7 +783,7 @@
 
         cls.router = cls.tester.qdrouterd('PolicyLinkNamePatternTest', config, wait=False)
         try:
-            cls.router.wait_ready(timeout = 5)
+            cls.router.wait_ready(timeout=5)
         except Exception as e:
             pass
 
@@ -1005,7 +1009,7 @@
 
         cls.router = cls.tester.qdrouterd('PolicyVhostNamePatternTest', config, wait=True)
         try:
-            cls.router.wait_ready(timeout = 5)
+            cls.router.wait_ready(timeout=5)
         except Exception:
             pass
 
@@ -1246,6 +1250,7 @@
         bc2.connection.close()
         bc3.connection.close()
 
+
 class ClientAddressValidator(MessagingHandler):
     """
     Base client class used to validate vhost policies through
@@ -1302,6 +1307,7 @@
     Receiver implementation used to validate vhost policies
     applied to source addresses.
     """
+
     def __init__(self, url):
         super(ReceiverAddressValidator, self).__init__(url)
 
@@ -1319,6 +1325,7 @@
     Sender implementation used to validate vhost policies
     applied to target addresses.
     """
+
     def __init__(self, url):
         super(SenderAddressValidator, self).__init__(url)
 
@@ -1340,6 +1347,7 @@
     This client is targeted by a misconfigured connector whose policy
     causes an immediate connection close.
     '''
+
     def __init__(self, url, container_id=None):
         self.connection_opening = 0
         self.connection_opened = 0
@@ -1379,7 +1387,7 @@
     def on_connection_opening(self, event):
         self.connection_opening += 1
         super(ConnectorPolicyMisconfiguredClient, self).on_connection_opening(event)
-        
+
     def on_connection_opened(self, event):
         self.connection_opened += 1
         super(ConnectorPolicyMisconfiguredClient, self).on_connection_opened(event)
@@ -1394,12 +1402,12 @@
     to open the connection if the policy is not defined
     """
     remoteListenerPort = None
-    
+
     @classmethod
     def setUpClass(cls):
         """Start the router"""
         super(ConnectorPolicyMisconfigured, cls).setUpClass()
-        cls.remoteListenerPort = cls.tester.get_port();
+        cls.remoteListenerPort = cls.tester.get_port()
         config = Qdrouterd.Config([
             ('router', {'mode': 'standalone', 'id': 'QDR.Policy'}),
             ('listener', {'port': cls.tester.get_port()}),
@@ -1408,7 +1416,7 @@
                            'idleTimeoutSeconds': 120, 'saslMechanisms': 'ANONYMOUS',
                            'host': '127.0.0.1', 'role': 'normal',
                            'port': cls.remoteListenerPort, 'policyVhost': 'nosuch'
-                            }),
+                           }),
 
             ('vhost', {
                 'hostname': '0.0.0.0', 'maxConnections': 2,
@@ -1441,18 +1449,20 @@
     def test_30_connector_policy_misconfigured(self):
         url = "127.0.0.1:%d" % self.remoteListenerPort
         tc = ConnectorPolicyMisconfiguredClient(url, "tc")
-        while tc.connection_error == 0 and tc._error == None:
+        while tc.connection_error == 0 and tc._error is None:
             time.sleep(0.1)
         tc.join()
         self.assertTrue(tc.connection_error == 1)
-        
+
 #
 
+
 class ConnectorPolicyClient(FakeBroker):
     '''
     This client is targeted by a configured connector whose policy
     allows certain sources and targets.
     '''
+
     def __init__(self, url, container_id=None):
         self.connection_opening = 0
         self.connection_opened = 0
@@ -1480,13 +1490,13 @@
                 if not self.request_in_flight:
                     if self.sender_request != "":
                         sndr = self._container.create_sender(
-                                self._connections[0], self.sender_request)
+                            self._connections[0], self.sender_request)
                         self.senders.append(sndr)
                         self.request_in_flight = True
                         self.sender_request = ""
                     elif self.receiver_request != "":
                         rcvr = self._container.create_receiver(
-                                self._connections[0], self.receiver_request)
+                            self._connections[0], self.receiver_request)
                         self.receivers.append(rcvr)
                         self.request_in_flight = True
                         self.receiver_request = ""
@@ -1498,7 +1508,7 @@
                         self.req_close_receiver = False
                     elif self.req_anonymous_sender:
                         sndr = self._container.create_sender(
-                                self._connections[0], name="anon")
+                            self._connections[0], name="anon")
                         self.senders.append(sndr)
                         self.request_in_flight = True
                         self.req_anonymous_sender = False
@@ -1593,7 +1603,7 @@
     def setUpClass(cls):
         """Start the router"""
         super(ConnectorPolicySrcTgt, cls).setUpClass()
-        cls.remoteListenerPort = cls.tester.get_port();
+        cls.remoteListenerPort = cls.tester.get_port()
         config = Qdrouterd.Config([
             ('router', {'mode': 'standalone', 'id': 'QDR.Policy'}),
             ('listener', {'port': cls.tester.get_port()}),
@@ -1602,7 +1612,7 @@
                            'idleTimeoutSeconds': 120, 'saslMechanisms': 'ANONYMOUS',
                            'host': '127.0.0.1', 'role': 'normal',
                            'port': cls.remoteListenerPort, 'policyVhost': 'test'
-                            }),
+                           }),
             # Set up the prefix 'node' as a prefix for waypoint addresses
             ('address',  {'prefix': 'node', 'waypoint': 'yes'}),
             # Create a pair of default auto-links for 'node.1'
@@ -1627,14 +1637,14 @@
     def test_31_connector_policy(self):
         url = "127.0.0.1:%d" % self.remoteListenerPort
         cpc = ConnectorPolicyClient(url, "cpc")
-        while cpc.connection_opened == 0 and cpc._error == None:
+        while cpc.connection_opened == 0 and cpc._error is None:
             time.sleep(0.1)
         time.sleep(0.05)
-        self.assertTrue(cpc.connection_error == 0) # expect connection to stay up
+        self.assertTrue(cpc.connection_error == 0)  # expect connection to stay up
         self.assertTrue(cpc._error is None)
 
         # senders that should work
-        for addr in ["examples", "$management", "playtime"]: # allowed targets
+        for addr in ["examples", "$management", "playtime"]:  # allowed targets
             try:
                 res = cpc.try_sender(addr)
             except:
@@ -1652,7 +1662,7 @@
             self.assertTrue(res)
 
         # receivers that should fail
-        for addr in ["$management", "a/bad/addr"]: # denied sources
+        for addr in ["$management", "a/bad/addr"]:  # denied sources
             res = cpc.try_receiver(addr)
             self.assertFalse(res)
 
@@ -1681,7 +1691,7 @@
     def setUpClass(cls):
         """Start the router"""
         super(ConnectorPolicyNSndrRcvr, cls).setUpClass()
-        cls.remoteListenerPort = cls.tester.get_port();
+        cls.remoteListenerPort = cls.tester.get_port()
         config = Qdrouterd.Config([
             ('router', {'mode': 'standalone', 'id': 'QDR.Policy'}),
             ('listener', {'port': cls.tester.get_port()}),
@@ -1690,7 +1700,7 @@
                            'idleTimeoutSeconds': 120, 'saslMechanisms': 'ANONYMOUS',
                            'host': '127.0.0.1', 'role': 'normal',
                            'port': cls.remoteListenerPort, 'policyVhost': 'test'
-                            }),
+                           }),
             # Set up the prefix 'node' as a prefix for waypoint addresses
             ('address',  {'prefix': 'node', 'waypoint': 'yes'}),
             # Create a pair of default auto-links for 'node.1'
@@ -1719,10 +1729,10 @@
     def test_32_connector_policy_max_sndr_rcvr(self):
         url = "127.0.0.1:%d" % self.remoteListenerPort
         cpc = ConnectorPolicyClient(url, "cpc")
-        while cpc.connection_opened == 0 and cpc._error == None:
+        while cpc.connection_opened == 0 and cpc._error is None:
             time.sleep(0.1)
         time.sleep(0.05)
-        self.assertTrue(cpc.connection_error == 0) # expect connection to stay up
+        self.assertTrue(cpc.connection_error == 0)  # expect connection to stay up
         self.assertTrue(cpc._error is None)
 
         # senders that should work
@@ -1760,7 +1770,7 @@
             self.assertFalse(res)
 
         # close a sender and verify that another one only may open
-        addr="skyblue"
+        addr = "skyblue"
         cpc.close_sender()
 
         for i in range(1):
@@ -1816,7 +1826,7 @@
         cls.router = cls.tester.qdrouterd('vhost-policy-config-hash-pattern', config, wait=False)
         cls.timed_out = False
         try:
-            cls.router.wait_ready(timeout = 5)
+            cls.router.wait_ready(timeout=5)
         except Exception:
             cls.timed_out = True
 
@@ -1834,11 +1844,12 @@
     The hostname is expected to be an alias for a vhost. When the alias selects
     the vhost then the connection is allowed.
     """
+
     def __init__(self, test_host, target_hostname, send_address, print_to_console=False):
         super(PolicyConnectionAliasTest, self).__init__()
-        self.test_host = test_host # router listener
-        self.target_hostname = target_hostname # vhost name for AMQP Open
-        self.send_address = send_address # dummy address allowed by policy
+        self.test_host = test_host  # router listener
+        self.target_hostname = target_hostname  # vhost name for AMQP Open
+        self.send_address = send_address  # dummy address allowed by policy
 
         self.test_conn = None
         self.dummy_sender = None
@@ -1884,7 +1895,7 @@
             self._shut_down_test()
 
     def on_unhandled(self, method, *args):
-        pass # self.logger.log("on_unhandled %s" % (method))
+        pass  # self.logger.log("on_unhandled %s" % (method))
 
     def _shut_down_test(self):
         self.shut_down = True
@@ -1938,7 +1949,7 @@
                                    'allowDynamicSource': 'true'
                                }
                            }
-                })
+                           })
             ]
 
             config = Qdrouterd.Config(config)
diff --git a/tests/system_tests_policy_oversize_basic.py b/tests/system_tests_policy_oversize_basic.py
index ce90e40..dbe7cc2 100644
--- a/tests/system_tests_policy_oversize_basic.py
+++ b/tests/system_tests_policy_oversize_basic.py
@@ -23,7 +23,10 @@
 from __future__ import print_function
 
 import unittest as unittest
-import os, json, re, signal
+import os
+import json
+import re
+import signal
 import sys
 import time
 
@@ -46,6 +49,7 @@
 # oversize is allowed or denied by an ingress edge router but also
 # denied by the uplink interior router.
 
+
 class OversizeMessageTransferTest(MessagingHandler):
     """
     This test connects a sender and a receiver. Then it tries to send _count_
@@ -61,6 +65,7 @@
     With expect_block=False sender messages should be received normally.
     The test is a success when n_accepted == count.
     """
+
     def __init__(self, sender_host, receiver_host, test_address,
                  message_size=100000, count=10, expect_block=True, print_to_console=False):
         super(OversizeMessageTransferTest, self).__init__()
@@ -147,7 +152,7 @@
         if self.shut_down:
             return
         if event.connection == self.sender_conn:
-            if not event.connection.remote_condition is None:
+            if event.connection.remote_condition is not None:
                 if event.connection.remote_condition.name == OVERSIZE_CONDITION_NAME and \
                    event.connection.remote_condition.description == OVERSIZE_CONDITION_DESC:
                     self.logger.log("on_connection_remote_close: sender closed with correct condition")
@@ -196,8 +201,8 @@
             self._shut_down_test()
         else:
             done = (self.n_connection_error == 1) \
-                    if self.expect_block else \
-                    (self.n_sent == self.count and self.n_rcvd == self.count)
+                if self.expect_block else \
+                (self.n_sent == self.count and self.n_rcvd == self.count)
 
             if done:
                 self.logger.log("TEST DONE!!!")
@@ -237,7 +242,6 @@
             self.logger.dump()
 
 
-
 # For the next test case define max sizes for each router.
 # These are the configured maxMessageSize values
 EA1_MAX_SIZE = 50000
@@ -303,7 +307,7 @@
                                    'allowDynamicSource': 'true'
                                }
                            }
-                })
+                           })
             ]
 
             if extra:
@@ -693,7 +697,6 @@
             test.logger.dump()
         self.assertTrue(test.error is None)
 
-
     def test_59_allow_undersize_EA1_INTB(self):
         test = OversizeMessageTransferTest(MaxMessageSizeBlockOversize.EA1,
                                            MaxMessageSizeBlockOversize.INT_B,
@@ -706,7 +709,6 @@
             test.logger.dump()
         self.assertTrue(test.error is None)
 
-
     def test_5a_allow_undersize_EA1_EA1(self):
         test = OversizeMessageTransferTest(MaxMessageSizeBlockOversize.EA1,
                                            MaxMessageSizeBlockOversize.EA1,
@@ -719,7 +721,6 @@
             test.logger.dump()
         self.assertTrue(test.error is None)
 
-
     def test_5b_allow_undersize_EA1_EB1(self):
         test = OversizeMessageTransferTest(MaxMessageSizeBlockOversize.EA1,
                                            MaxMessageSizeBlockOversize.EB1,
@@ -744,7 +745,6 @@
             test.logger.dump()
         self.assertTrue(test.error is None)
 
-
     def test_5d_allow_undersize_EB1_INTB(self):
         test = OversizeMessageTransferTest(MaxMessageSizeBlockOversize.EB1,
                                            MaxMessageSizeBlockOversize.INT_B,
@@ -757,7 +757,6 @@
             test.logger.dump()
         self.assertTrue(test.error is None)
 
-
     def test_5e_allow_undersize_EB1_EA1(self):
         test = OversizeMessageTransferTest(MaxMessageSizeBlockOversize.EB1,
                                            MaxMessageSizeBlockOversize.EA1,
@@ -770,7 +769,6 @@
             test.logger.dump()
         self.assertTrue(test.error is None)
 
-
     def test_5f_allow_undersize_EB1_EB1(self):
         test = OversizeMessageTransferTest(MaxMessageSizeBlockOversize.EB1,
                                            MaxMessageSizeBlockOversize.EB1,
@@ -783,7 +781,6 @@
             test.logger.dump()
         self.assertTrue(test.error is None)
 
-
     def test_s32_allow_gt_signed_32bit_max(self):
         test = OversizeMessageTransferTest(MaxMessageSizeBlockOversize.S32,
                                            MaxMessageSizeBlockOversize.S32,
diff --git a/tests/system_tests_policy_oversize_compound.py b/tests/system_tests_policy_oversize_compound.py
index 8c5aeb8..380471b 100644
--- a/tests/system_tests_policy_oversize_compound.py
+++ b/tests/system_tests_policy_oversize_compound.py
@@ -23,7 +23,10 @@
 from __future__ import print_function
 
 import unittest as unittest
-import os, json, re, signal
+import os
+import json
+import re
+import signal
 import sys
 import time
 
@@ -74,6 +77,7 @@
 # the MulticastTransfer test does a single sender and four receivers.
 # Much of the logic between tests is duplicated. Remember to fix things in both tests.
 
+
 class OversizeMessageTransferTest(MessagingHandler):
     """
     This test connects a sender and a receiver. Then it tries to send _count_
@@ -98,6 +102,7 @@
     * The remainder of the messages are going into a closed connection and
     will receive no settlement.
     """
+
     def __init__(self, test_class, sender_host, receiver_host, test_address,
                  message_size=100000, count=10, blocked_by_both=False, print_to_console=False):
         """
@@ -142,7 +147,7 @@
         self.shut_down = False
 
         self.logger = Logger(title=("OversizeMessageTransferTest - %s" % (self.test_address)), print_to_console=print_to_console)
-        self.log_unhandled = False # verbose diagnostics of proton callbacks
+        self.log_unhandled = False  # verbose diagnostics of proton callbacks
 
     def timeout(self):
         current = ("check_done: sent=%d rcvd=%d rejected=%d aborted=%d connection_error:%d send_settled:%d" %
@@ -176,7 +181,7 @@
             m = Message(body=body_msg)
             self.messages.append(m)
 
-        if not self.receiver_host is None:
+        if self.receiver_host is not None:
             self.logger.log("on_start: opening receiver connection to %s" % (self.receiver_host.addresses[0]))
             self.receiver_conn = event.container.connect(self.receiver_host.addresses[0])
 
@@ -198,7 +203,7 @@
                             self.test_address, self.n_sent, self.count, self.msg_size))
             self.sender.send(m)
             self.n_sent += 1
-        #if self.n_sent == self.count:
+        # if self.n_sent == self.count:
         #    self.log_unhandled = True
 
     def on_sendable(self, event):
@@ -223,7 +228,7 @@
         if self.shut_down:
             return
         if event.connection == self.sender_conn:
-            if not event.connection.remote_condition is None:
+            if event.connection.remote_condition is not None:
                 if event.connection.remote_condition.name == OVERSIZE_CONDITION_NAME and \
                    event.connection.remote_condition.description == OVERSIZE_CONDITION_DESC:
                     self.logger.log("on_connection_remote_close: sender closed with correct condition")
@@ -265,7 +270,7 @@
 
     def _current(self):
         return ("net_stable=%s sent=%d rcvd=%d rejected=%d aborted=%d connection_error:%d send_settled:%d" %
-                   (self.network_stable, self.n_sent, self.n_rcvd, self.n_rejected, self.n_aborted, self.n_connection_error, self.n_send_settled))
+                (self.network_stable, self.n_sent, self.n_rcvd, self.n_rejected, self.n_aborted, self.n_connection_error, self.n_send_settled))
 
     def _check_done(self):
         self.logger.log("check_done: " + self._current())
@@ -277,13 +282,13 @@
                 # Blocked by interior only. Connection to edge stays up
                 # and all messages must be accounted for.
                 done = self.n_rejected == 1 and \
-                       self.n_send_settled == self.count
+                    self.n_send_settled == self.count
             else:
                 # Blocked by interior and edge. Expect edge connection to go down
                 # and some of our messaages arrive at edge after it has sent
                 # AMQP close. Those messages are never settled. TODO: Is that OK?
                 done = self.n_rejected == 1 and \
-                       self.n_connection_error == 1
+                    self.n_connection_error == 1
             if done:
                 self.logger.log("TEST DONE!!!")
                 # self.log_unhandled = True # verbose debugging
@@ -315,7 +320,7 @@
         self.error = "Container error"
         self.logger.log(self.error)
         self.sender_conn.close()
-        if not self.receiver is None:
+        if self.receiver is not None:
             self.receiver_conn.close()
         self.timer.cancel()
 
@@ -341,6 +346,7 @@
             self.logger.dump()
         time.sleep(0.2)
 
+
 #
 # DISPATCH-975 Detect that an oversize message is blocked.
 # These tests check simple and compound blocking for multicast messages.
@@ -351,11 +357,13 @@
 IDX_EA1 = 2
 IDX_EB1 = 3
 
+
 class OversizeMulticastTransferTest(MessagingHandler):
     """
     This test connects a sender and four receivers. Then it tries to send _count_
     number of messages of the given size through the router or router network.
     """
+
     def __init__(self, test_class, sender_host, routers, test_address, expect_receives,
                  blocked_by_ingress, blocked_by_interior,
                  message_size=100000, count=10, print_to_console=False):
@@ -379,32 +387,32 @@
         self.test_address = test_address
         self.msg_size = message_size
         self.count = count
-        self.expect_receives = expect_receives # router array
+        self.expect_receives = expect_receives  # router array
         self.blocked_by_ingress = blocked_by_ingress
         self.blocked_by_interior = blocked_by_interior
         self.messages = []
 
         self.sender_conn = None
-        self.receiver_conns = [None, None, None, None] # router array
+        self.receiver_conns = [None, None, None, None]  # router array
         self.error = None
         self.sender = None
-        self.receivers = [None, None, None, None] # router array
+        self.receivers = [None, None, None, None]  # router array
         self.proxy = None
 
         self.network_stable = False
         self.n_sent = 0
-        self.n_rcvds = [0, 0, 0, 0] # router array
+        self.n_rcvds = [0, 0, 0, 0]  # router array
         self.n_accepted = 0
         self.n_rejected = 0
         self.n_modified = 0
         self.n_released = 0
         self.n_send_settled = 0
-        self.n_aborteds = [0, 0, 0, 0] # router array
+        self.n_aborteds = [0, 0, 0, 0]  # router array
         self.n_connection_error = 0
         self.shut_down = False
 
         self.logger = Logger(title=("OversizeMulticastTransferTest - %s" % (self.test_address)), print_to_console=print_to_console)
-        self.log_unhandled = False # verbose diagnostics of proton callbacks
+        self.log_unhandled = False  # verbose diagnostics of proton callbacks
 
     def timeout(self):
         current = self._current()
@@ -468,7 +476,6 @@
         self._shut_down_test()
         raise Exception(self.error)
 
-
     def send(self):
         while self.sender.credit > 0 and self.n_sent < self.count:
             m = self.messages[self.n_sent]
@@ -476,7 +483,7 @@
                             self.test_address, self.n_sent, self.count, self.msg_size))
             self.sender.send(m)
             self.n_sent += 1
-        #if self.n_sent == self.count:
+        # if self.n_sent == self.count:
         #    self.log_unhandled = True
 
     def on_sendable(self, event):
@@ -503,7 +510,7 @@
         if self.shut_down:
             return
         if event.connection == self.sender_conn:
-            if not event.connection.remote_condition is None:
+            if event.connection.remote_condition is not None:
                 if event.connection.remote_condition.name == OVERSIZE_CONDITION_NAME and \
                    event.connection.remote_condition.description == OVERSIZE_CONDITION_DESC:
                     self.logger.log("on_connection_remote_close: sender closed with correct condition")
@@ -547,7 +554,7 @@
 
     def _current(self):
         return ("net_stable:%s sent=%d rcvd=%s rejected=%d aborted=%s connection_error:%d send_settled:%d" %
-               (self.network_stable, self.n_sent, str(self.n_rcvds), self.n_rejected, str(self.n_aborteds), self.n_connection_error, self.n_send_settled))
+                (self.network_stable, self.n_sent, str(self.n_rcvds), self.n_rejected, str(self.n_aborteds), self.n_connection_error, self.n_send_settled))
 
     def _check_done(self):
         self.logger.log("check_done: " + self._current())
@@ -561,7 +568,7 @@
                     # and some of our messaages arrive at edge after it has sent
                     # AMQP close. Those messages are never settled. TODO: Is that OK?
                     done = self.n_rejected == 1 and \
-                           self.n_connection_error == 1
+                        self.n_connection_error == 1
                 else:
                     # Blocked by interior only. Connection to edge stays up
                     # and all messages must be accounted for.
@@ -571,12 +578,12 @@
                             if not self.n_rcvds[idx] == self.expect_receives[idx]:
                                 all_received = False
                     done = self.n_rejected <= 1 and \
-                           self.n_send_settled == self.count and \
-                           all_received
+                        self.n_send_settled == self.count and \
+                        all_received
             else:
                 # Blocked by edge should never deliver to interior
                 done = self.n_rejected == 1 and \
-                       self.n_connection_error == 1
+                    self.n_connection_error == 1
 
             if done:
                 self.logger.log("TEST DONE!!!")
@@ -657,19 +664,19 @@
                 ('policy', {'maxConnections': 100, 'enableVhostPolicy': 'true', 'maxMessageSize': max_size, 'defaultVhost': '$default'}),
                 ('address', {'prefix': 'multicast', 'distribution': 'multicast'}),
                 ('vhost', {'hostname': '$default', 'allowUnknownUser': 'true',
-                    'groups': {
-                        '$default': {
-                            'users': '*',
-                            'maxConnections': 100,
-                            'remoteHosts': '*',
-                            'sources': '*',
-                            'targets': '*',
-                            'allowAnonymousSender': True,
-                            'allowWaypointLinks': True,
-                            'allowDynamicSource': True
-                        }
-                    }
-                })
+                           'groups': {
+                               '$default': {
+                                   'users': '*',
+                                   'maxConnections': 100,
+                                   'remoteHosts': '*',
+                                   'sources': '*',
+                                   'targets': '*',
+                                   'allowAnonymousSender': True,
+                                   'allowWaypointLinks': True,
+                                   'allowDynamicSource': True
+                               }
+                           }
+                           })
             ]
 
             if extra:
@@ -765,13 +772,12 @@
         :param routername:
         :return: (int, int) tuple with counts of lines in and lines out
         """
-        with  open("../setUpClass/%s.log" % routername, 'r') as router_log:
+        with open("../setUpClass/%s.log" % routername, 'r') as router_log:
             log_lines = router_log.read().split("\n")
         i_closed_lines = [s for s in log_lines if pattern in s and "<-" in s]
         o_closed_lines = [s for s in log_lines if pattern in s and "->" in s]
         return (len(i_closed_lines), len(o_closed_lines))
 
-
     # verify that a message can go through an edge EB1 and get blocked by interior INT.B
     #
     #  +-------+    +---------+    +---------+    +-------+
@@ -785,6 +791,7 @@
     #                               |        |    |199,800|
     #                               +--------+    +-------+
     #
+
     def test_60_block_oversize_EB1_INTB_at_INTB(self):
         ibefore, obefore = self.sense_n_closed_lines("EB1")
         test = OversizeMessageTransferTest(MaxMessageSizeBlockOversize,
@@ -819,7 +826,6 @@
             test.logger.dump()
             self.assertTrue(success, "Expected router to generate link close with condition: amqp:link:message-size-exceeded")
 
-
     # verify that a message can go through an edge EB1 and get blocked by interior INT.B
     #
     #  +-------+    +---------+    +---------+    +-------+
@@ -833,6 +839,7 @@
     #   |        |                                |199,800|
     #   +--------+                                +-------+
     #
+
     def test_61_block_oversize_EB1_EA1_at_INTB(self):
         ibefore, obefore = self.sense_n_closed_lines("EB1")
         test = OversizeMessageTransferTest(MaxMessageSizeBlockOversize,
@@ -858,7 +865,6 @@
             test.logger.dump()
             self.assertTrue(success, "Expected router to generate close with condition: message size exceeded")
 
-
     # see what happens when a message must be blocked by edge and also by interior
     #
     #  +-------+    +---------+    +---------+    +-------+
@@ -872,6 +878,7 @@
     #                               |        |    |200,200|
     #                               +--------+    +-------+
     #
+
     def test_70_block_oversize_EB1_INTB_at_both(self):
         ibefore, obefore = self.sense_n_closed_lines("EB1")
         test = OversizeMessageTransferTest(MaxMessageSizeBlockOversize,
@@ -903,7 +910,6 @@
             test.logger.dump()
             self.assertTrue(success, "Expected router to generate close with condition: message size exceeded")
 
-
     # Verify that a multicast can go through an edge EB1 and get blocked by interior INT.B
     #
     #  +-------+    +---------+    +---------+    +-------+
@@ -923,6 +929,7 @@
     #                                             |199,800|
     #                                             +-------+
     #
+
     def test_80_block_multicast_EB1_INTB_at_INTB(self):
         ibefore, obefore = self.sense_n_closed_lines("EB1")
         count = 10
@@ -931,10 +938,10 @@
                                              MaxMessageSizeBlockOversize.routers,
                                              "multicast/e80",
                                              [0, 0, 0, count],
-                                             blocked_by_ingress = False,
-                                             blocked_by_interior = True,
+                                             blocked_by_ingress=False,
+                                             blocked_by_interior=True,
                                              message_size=EB1_MAX_SIZE - OVER_UNDER,
-                                             count = count,
+                                             count=count,
                                              print_to_console=False)
         test.run()
         if test.error is not None:
@@ -953,7 +960,6 @@
             test.logger.dump()
             self.assertTrue(success, "Expected router to generate close with condition: message size exceeded")
 
-
     # Verify that a multicast blocked by edge ingress goes to no receivers
     #
     #  +-------+    +---------+    +---------+    +-------+
@@ -973,6 +979,7 @@
     #  | 50,200|
     #  +-------+
     #
+
     def test_81_block_multicast_EA1(self):
         ibefore, obefore = self.sense_n_closed_lines("EA1")
         count = 10
@@ -981,10 +988,10 @@
                                              MaxMessageSizeBlockOversize.routers,
                                              "multicast/e81",
                                              [0, 0, 0, 0],
-                                             blocked_by_ingress = True,
-                                             blocked_by_interior = False,
+                                             blocked_by_ingress=True,
+                                             blocked_by_interior=False,
                                              message_size=EA1_MAX_SIZE + OVER_UNDER,
-                                             count = count,
+                                             count=count,
                                              print_to_console=False)
         test.run()
         if test.error is not None:
@@ -1003,7 +1010,6 @@
             test.logger.dump()
             self.assertTrue(success, "Expected router to generate close with condition: message size exceeded")
 
-
     # Verify that a multicast blocked by interior ingress goes to no receivers
     #
     #  +-------+    +---------+    +---------+    +-------+
@@ -1023,6 +1029,7 @@
     #               |100,200|
     #               +-------+
     #
+
     def test_82_block_multicast_INTA(self):
         ibefore, obefore = self.sense_n_closed_lines("INT.A")
         count = 10
@@ -1058,10 +1065,12 @@
 # Link route
 #
 
+
 class Dummy(FakeBroker):
     """
     Open a link and sit there. No traffic is expected to reach this broker
     """
+
     def __init__(self, url, container_id):
         super(Dummy, self).__init__(url, container_id)
 
@@ -1096,19 +1105,19 @@
                 ('linkRoute', {'prefix': 'oversize', 'containerId': 'FakeBroker', 'direction': 'in'}),
                 ('linkRoute', {'prefix': 'oversize', 'containerId': 'FakeBroker', 'direction': 'out'}),
                 ('vhost', {'hostname': '$default', 'allowUnknownUser': 'true',
-                    'groups': {
-                        '$default': {
-                            'users': '*',
-                            'maxConnections': 100,
-                            'remoteHosts': '*',
-                            'sources': '*',
-                            'targets': '*',
-                            'allowAnonymousSender': True,
-                            'allowWaypointLinks': True,
-                            'allowDynamicSource': True
-                        }
-                    }
-                })
+                           'groups': {
+                               '$default': {
+                                   'users': '*',
+                                   'maxConnections': 100,
+                                   'remoteHosts': '*',
+                                   'sources': '*',
+                                   'targets': '*',
+                                   'allowAnonymousSender': True,
+                                   'allowWaypointLinks': True,
+                                   'allowDynamicSource': True
+                               }
+                           }
+                           })
             ]
 
             if extra:
@@ -1159,7 +1168,7 @@
                                'port': interrouter_port}),
                 ('listener', {'role': 'edge',
                               'port': cls.INTB_edge_port}),
-                ('connector',  {'name': 'FakeBroker',
+                ('connector', {'name': 'FakeBroker',
                                'role': 'route-container',
                                'host': '127.0.0.1',
                                'port': cls.fb_port,
@@ -1190,7 +1199,7 @@
         cls.wait_router_network_connected()
 
         cls.fake_broker = Dummy("amqp://127.0.0.1:" + str(cls.fb_port),
-                                       container_id="FakeBroker")
+                                container_id="FakeBroker")
         cls.INT_B.wait_address("oversize",
                                containers=1, count=2)
 
@@ -1214,13 +1223,12 @@
         :param routername:
         :return: (int, int) tuple with counts of lines in and lines out
         """
-        with  open("../setUpClass/%s.log" % routername, 'r') as router_log:
+        with open("../setUpClass/%s.log" % routername, 'r') as router_log:
             log_lines = router_log.read().split("\n")
         i_closed_lines = [s for s in log_lines if OVERSIZE_CONDITION_NAME in s and "<-" in s]
         o_closed_lines = [s for s in log_lines if OVERSIZE_CONDITION_NAME in s and "->" in s]
         return (len(i_closed_lines), len(o_closed_lines))
 
-
     # verify that a message can go through an edge EB1 and get blocked by interior INT.B
     #
     #  +-------+    +---------+    +---------+    +-------+
@@ -1234,6 +1242,7 @@
     #                               | broker |    |200,200|
     #                               +--------+    +-------+
     #
+
     def test_90_block_link_route_EB1_INTB(self):
         ibefore, obefore = self.sense_n_closed_lines("EB1")
         test = OversizeMessageTransferTest(MaxMessageSizeLinkRouteOversize,
diff --git a/tests/system_tests_priority.py b/tests/system_tests_priority.py
index c05954a..42528a9 100644
--- a/tests/system_tests_priority.py
+++ b/tests/system_tests_priority.py
@@ -23,63 +23,63 @@
 from __future__ import absolute_import
 from __future__ import print_function
 
-from proton          import Message, Timeout
-from system_test     import TestCase, Qdrouterd, main_module, Process, unittest
+from proton import Message, Timeout
+from system_test import TestCase, Qdrouterd, main_module, Process, unittest
 from proton.handlers import MessagingHandler
-from proton.reactor  import Container
+from proton.reactor import Container
 
 from qpid_dispatch_internal.compat import UNICODE
 
-#------------------------------------------------
+# ------------------------------------------------
 # Helper classes for all tests.
-#------------------------------------------------
+# ------------------------------------------------
+
 
 class Timeout(object):
     """
     Named timeout object can handle multiple simultaneous
     timers, by telling the parent which one fired.
     """
-    def __init__ ( self, parent, name ):
+
+    def __init__(self, parent, name):
         self.parent = parent
         self.name   = name
 
-    def on_timer_task ( self, event ):
-        self.parent.timeout ( self.name )
+    def on_timer_task(self, event):
+        self.parent.timeout(self.name)
 
 
-
-class ManagementMessageHelper ( object ):
+class ManagementMessageHelper (object):
     """
     Format management messages.
     """
-    def __init__ ( self, reply_addr ):
+
+    def __init__(self, reply_addr):
         self.reply_addr = reply_addr
 
-    def make_router_link_query ( self ) :
-        props = { 'count':      '100',
-                  'operation':  'QUERY',
-                  'entityType': 'org.apache.qpid.dispatch.router.link',
-                  'name':       'self',
-                  'type':       'org.amqp.management'
-                }
+    def make_router_link_query(self) :
+        props = {'count':      '100',
+                 'operation':  'QUERY',
+                 'entityType': 'org.apache.qpid.dispatch.router.link',
+                 'name':       'self',
+                 'type':       'org.amqp.management'
+                 }
         attrs = []
-        attrs.append ( UNICODE('linkType') )
-        attrs.append ( UNICODE('linkDir') )
-        attrs.append ( UNICODE('deliveryCount') )
-        attrs.append ( UNICODE('priority') )
+        attrs.append(UNICODE('linkType'))
+        attrs.append(UNICODE('linkDir'))
+        attrs.append(UNICODE('deliveryCount'))
+        attrs.append(UNICODE('priority'))
 
-        msg_body = { }
-        msg_body [ 'attributeNames' ] = attrs
-        return Message ( body=msg_body, properties=props, reply_to=self.reply_addr )
+        msg_body = {}
+        msg_body['attributeNames'] = attrs
+        return Message(body=msg_body, properties=props, reply_to=self.reply_addr)
 
 
-
-
-#================================================================
+# ================================================================
 #     Setup
-#================================================================
+# ================================================================
 
-class PriorityTests ( TestCase ):
+class PriorityTests (TestCase):
 
     @classmethod
     def setUpClass(cls):
@@ -87,12 +87,12 @@
 
         def router(name, more_config):
 
-            config = [ ('router',  {'mode': 'interior', 'id': name, 'workerThreads': 4}),
-                       ('address', {'prefix': 'closest',   'distribution': 'closest'}),
-                       ('address', {'prefix': 'balanced',  'distribution': 'balanced'}),
-                       ('address', {'prefix': 'multicast', 'distribution': 'multicast'})
-                     ]    \
-                     + more_config
+            config = [('router',  {'mode': 'interior', 'id': name, 'workerThreads': 4}),
+                      ('address', {'prefix': 'closest',   'distribution': 'closest'}),
+                      ('address', {'prefix': 'balanced',  'distribution': 'balanced'}),
+                      ('address', {'prefix': 'multicast', 'distribution': 'multicast'})
+                      ]    \
+                + more_config
 
             config = Qdrouterd.Config(config)
 
@@ -117,83 +117,81 @@
         C_inter_router_port = cls.tester.get_port()
 
         A_config = [
-                     ( 'listener',
-                       { 'port'             : A_client_port,
-                         'role'             : 'normal',
-                         'linkCapacity'     : link_cap,
-                         'stripAnnotations' : 'no'
-                       }
-                     ),
-                     ( 'listener',
-                       { 'role'             : 'inter-router',
-                         'port'             : A_inter_router_port,
-                         'linkCapacity'     : link_cap,
-                         'stripAnnotations' : 'no'
-                       }
-                     ),
-                     ( 'address',
-                       { 'prefix'       : 'speedy',
-                         'priority'     : cls.magic_address_priority,
-                         'distribution' : 'closest'
-                       }
-                     ),
-                   ]
+            ('listener',
+             {'port'             : A_client_port,
+              'role'             : 'normal',
+              'linkCapacity'     : link_cap,
+              'stripAnnotations' : 'no'
+              }
+             ),
+            ('listener',
+             {'role'             : 'inter-router',
+              'port'             : A_inter_router_port,
+              'linkCapacity'     : link_cap,
+              'stripAnnotations' : 'no'
+              }
+             ),
+            ('address',
+             {'prefix'       : 'speedy',
+              'priority'     : cls.magic_address_priority,
+              'distribution' : 'closest'
+              }
+             ),
+        ]
 
         cls.B_config = [
-                         ( 'listener',
-                           { 'port'             : B_client_port,
-                             'role'             : 'normal',
-                             'linkCapacity'     : link_cap,
-                             'stripAnnotations' : 'no'
-                           }
-                         ),
-                         ( 'listener',
-                           { 'role'             : 'inter-router',
-                             'port'             : B_inter_router_port,
-                             'linkCapacity'     : link_cap,
-                             'stripAnnotations' : 'no'
-                           }
-                         ),
-                         ( 'connector',
-                           { 'name'             : 'BA_connector',
-                             'role'             : 'inter-router',
-                             'port'             : A_inter_router_port,
-                             'linkCapacity'     : link_cap,
-                             'stripAnnotations' : 'no'
-                           }
-                         )
-                      ]
+            ('listener',
+             {'port'             : B_client_port,
+              'role'             : 'normal',
+              'linkCapacity'     : link_cap,
+              'stripAnnotations' : 'no'
+              }
+             ),
+            ('listener',
+             {'role'             : 'inter-router',
+              'port'             : B_inter_router_port,
+              'linkCapacity'     : link_cap,
+              'stripAnnotations' : 'no'
+              }
+             ),
+            ('connector',
+             {'name'             : 'BA_connector',
+              'role'             : 'inter-router',
+              'port'             : A_inter_router_port,
+              'linkCapacity'     : link_cap,
+              'stripAnnotations' : 'no'
+              }
+             )
+        ]
 
         C_config = [
-                     ( 'listener',
-                       { 'port'             : C_client_port,
-                         'role'             : 'normal',
-                         'linkCapacity'     : link_cap,
-                         'stripAnnotations' : 'no'
-                       }
-                     ),
-                     ( 'listener',
-                       { 'role'             : 'inter-router',
-                         'port'             : C_inter_router_port,
-                         'linkCapacity'     : link_cap,
-                         'stripAnnotations' : 'no'
-                       }
-                     ),
-                     ( 'connector',
-                       { 'name'             : 'CB_connector',
-                         'role'             : 'inter-router',
-                         'port'             : B_inter_router_port,
-                         'linkCapacity'     : link_cap,
-                         'stripAnnotations' : 'no'
-                       }
-                     )
-                  ]
+            ('listener',
+             {'port'             : C_client_port,
+              'role'             : 'normal',
+              'linkCapacity'     : link_cap,
+              'stripAnnotations' : 'no'
+              }
+             ),
+            ('listener',
+             {'role'             : 'inter-router',
+              'port'             : C_inter_router_port,
+              'linkCapacity'     : link_cap,
+              'stripAnnotations' : 'no'
+              }
+             ),
+            ('connector',
+             {'name'             : 'CB_connector',
+              'role'             : 'inter-router',
+              'port'             : B_inter_router_port,
+              'linkCapacity'     : link_cap,
+              'stripAnnotations' : 'no'
+              }
+             )
+        ]
 
-
-        router ( 'A', A_config )
-        router ( 'B', cls.B_config )
-        router ( 'C', C_config )
-
+        router('A', A_config)
+        router('B', cls.B_config)
+        router('C', C_config)
 
         router_A = cls.routers[0]
         router_B = cls.routers[1]
@@ -202,32 +200,30 @@
         router_A.wait_router_connected('B')
         router_A.wait_router_connected('C')
 
-        cls.client_addrs = ( router_A.addresses[0],
-                             router_B.addresses[0],
-                             router_C.addresses[0]
-                           )
+        cls.client_addrs = (router_A.addresses[0],
+                            router_B.addresses[0],
+                            router_C.addresses[0]
+                            )
 
-
-    def test_priority ( self ):
+    def test_priority(self):
         name = 'test_01'
-        test = Priority ( self,
-                          name,
-                          self.client_addrs,
-                          "speedy/01",
-                          self.magic_message_priority,
-                          self.magic_address_priority
+        test = Priority(self,
+                        name,
+                        self.client_addrs,
+                        "speedy/01",
+                        self.magic_message_priority,
+                        self.magic_address_priority
                         )
         test.run()
-        self.assertEqual ( None, test.error )
+        self.assertEqual(None, test.error)
 
 
-
-#================================================================
+# ================================================================
 #     Tests
-#================================================================
+# ================================================================
 
 
-class Priority ( MessagingHandler ):
+class Priority (MessagingHandler):
 
     # In this test we will have a linear network of 3 routers.
     # The sender attaches at A, and the receiver at C.
@@ -267,7 +263,7 @@
     # then send management queries to A and B to learn at what
     # priorities the messages actually travelled.
 
-    def __init__ ( self, parent, test_name, client_addrs, destination, magic_msg_priority, magic_addr_priority ):
+    def __init__(self, parent, test_name, client_addrs, destination, magic_msg_priority, magic_addr_priority):
         super(Priority, self).__init__(prefetch=10)
 
         self.parent          = parent
@@ -297,106 +293,98 @@
         self.B_addr          = self.client_addrs[1]
         self.C_addr          = self.client_addrs[2]
         self.routers = {
-                         'A' : dict(),
-                         'B' : dict()
-                       }
-
+            'A' : dict(),
+            'B' : dict()
+        }
 
     # Shut down everything and exit.
-    def bail ( self, text ):
-        self.send_timer.cancel ( )
+    def bail(self, text):
+        self.send_timer.cancel()
         self.finishing = True
         self.error = text
         for conn in self.connections :
             conn.close()
 
-
-    def make_connection ( self, event, addr ) :
-        cnx = event.container.connect ( addr )
-        self.connections.append ( cnx )
+    def make_connection(self, event, addr) :
+        cnx = event.container.connect(addr)
+        self.connections.append(cnx)
         return cnx
 
-
-    def on_start ( self, event ):
+    def on_start(self, event):
         self.reactor = event.reactor
-        self.send_conn  = self.make_connection ( event,  self.A_addr )
-        self.recv_conn  = self.make_connection ( event,  self.C_addr )
+        self.send_conn  = self.make_connection(event, self.A_addr)
+        self.recv_conn  = self.make_connection(event, self.C_addr)
 
-        self.sender     = event.container.create_sender   ( self.send_conn, self.dest )
-        self.receiver   = event.container.create_receiver ( self.recv_conn, self.dest )
-        self.receiver.flow ( 100 )
+        self.sender     = event.container.create_sender(self.send_conn, self.dest)
+        self.receiver   = event.container.create_receiver(self.recv_conn, self.dest)
+        self.receiver.flow(100)
 
-        self.routers['A'] ['mgmt_conn']     = self.make_connection ( event, self.A_addr )
-        self.routers['A'] ['mgmt_receiver'] = event.container.create_receiver ( self.routers['A'] ['mgmt_conn'], dynamic=True )
-        self.routers['A'] ['mgmt_sender']   = event.container.create_sender   ( self.routers['A'] ['mgmt_conn'], "$management" )
+        self.routers['A']['mgmt_conn']     = self.make_connection(event, self.A_addr)
+        self.routers['A']['mgmt_receiver'] = event.container.create_receiver(self.routers['A']['mgmt_conn'], dynamic=True)
+        self.routers['A']['mgmt_sender']   = event.container.create_sender(self.routers['A']['mgmt_conn'], "$management")
 
-        self.routers['B'] ['mgmt_conn']     = self.make_connection ( event, self.B_addr )
-        self.routers['B'] ['mgmt_receiver'] = event.container.create_receiver ( self.routers['B'] ['mgmt_conn'], dynamic=True )
-        self.routers['B'] ['mgmt_sender']   = event.container.create_sender   ( self.routers['B'] ['mgmt_conn'], "$management" )
+        self.routers['B']['mgmt_conn']     = self.make_connection(event, self.B_addr)
+        self.routers['B']['mgmt_receiver'] = event.container.create_receiver(self.routers['B']['mgmt_conn'], dynamic=True)
+        self.routers['B']['mgmt_sender']   = event.container.create_sender(self.routers['B']['mgmt_conn'], "$management")
 
-        self.send_timer = event.reactor.schedule ( 2, Timeout(self, "send") )
+        self.send_timer = event.reactor.schedule(2, Timeout(self, "send"))
 
-
-    def timeout ( self, name ):
+    def timeout(self, name):
         if name == 'send':
-            self.send ( )
+            self.send()
             if not self.sent_queries :
-                self.test_timer = self.reactor.schedule ( 1, Timeout(self, "send") )
+                self.test_timer = self.reactor.schedule(1, Timeout(self, "send"))
 
-
-    def on_link_opened ( self, event ) :
+    def on_link_opened(self, event) :
         # A mgmt link has opened. Create its management helper.
         # ( Now we know the address that the management helper should use as
         # the "reply-to" in its management message. )
-        if event.receiver == self.routers['A'] ['mgmt_receiver'] :
-            event.receiver.flow ( 1000 )
-            self.routers['A'] ['mgmt_helper'] = ManagementMessageHelper ( event.receiver.remote_source.address )
+        if event.receiver == self.routers['A']['mgmt_receiver'] :
+            event.receiver.flow(1000)
+            self.routers['A']['mgmt_helper'] = ManagementMessageHelper(event.receiver.remote_source.address)
 
-        elif event.receiver == self.routers['B'] ['mgmt_receiver'] :
-            event.receiver.flow ( 1000 )
-            self.routers['B'] ['mgmt_helper'] = ManagementMessageHelper ( event.receiver.remote_source.address )
+        elif event.receiver == self.routers['B']['mgmt_receiver'] :
+            event.receiver.flow(1000)
+            self.routers['B']['mgmt_helper'] = ManagementMessageHelper(event.receiver.remote_source.address)
 
-
-    def send ( self ) :
+    def send(self) :
         if self.sender.credit <= 0:
-            self.receiver.flow ( 100 )
+            self.receiver.flow(100)
             return
 
         # First send the payload messages.
         if self.n_sent < self.n_messages :
             for i in range(50) :
-                msg = Message ( body=self.n_sent )
+                msg = Message(body=self.n_sent)
                 msg.priority = 3
-                self.sender.send ( msg )
+                self.sender.send(msg)
                 self.n_sent += 1
         # Then send the management queries.
         # But only send them once.
         elif not self.sent_queries  :
             # Query router A.
-            mgmt_helper = self.routers['A'] ['mgmt_helper']
-            mgmt_sender = self.routers['A'] ['mgmt_sender']
-            msg = mgmt_helper.make_router_link_query ( )
-            mgmt_sender.send ( msg )
+            mgmt_helper = self.routers['A']['mgmt_helper']
+            mgmt_sender = self.routers['A']['mgmt_sender']
+            msg = mgmt_helper.make_router_link_query()
+            mgmt_sender.send(msg)
 
             # Query router B.
-            mgmt_helper = self.routers['B'] ['mgmt_helper']
-            mgmt_sender = self.routers['B'] ['mgmt_sender']
-            msg = mgmt_helper.make_router_link_query ( )
-            mgmt_sender.send ( msg )
+            mgmt_helper = self.routers['B']['mgmt_helper']
+            mgmt_sender = self.routers['B']['mgmt_sender']
+            msg = mgmt_helper.make_router_link_query()
+            mgmt_sender.send(msg)
 
             self.sent_queries = True
 
-
     # This test has two goals: get the response from router A
     # and from router B. As they come in, we check them. If
     # the response is unsatisfactory we bail out
-    def goal_satisfied ( self ) :
+    def goal_satisfied(self) :
         self.goals += 1
         if self.goals >= self.n_goals :
-            self.bail ( None )
+            self.bail(None)
 
-
-    def on_message ( self, event ) :
+    def on_message(self, event) :
 
         # Don't take any more messages if 'bail' has been called.
         if self.finishing :
@@ -404,7 +392,7 @@
 
         msg = event.message
 
-        if event.receiver == self.routers['A'] ['mgmt_receiver'] :
+        if event.receiver == self.routers['A']['mgmt_receiver'] :
             # Router A has only one set of outgoing links, and it
             # has set a priority for our target address. We should
             # see all the messages we sent go out with that priority.
@@ -425,14 +413,14 @@
                     priority      = result[3]
                     if role == "inter-router" and dir == "out" and priority == magic  :
                         if message_count >= self.n_messages :
-                            self.goal_satisfied ( )
+                            self.goal_satisfied()
                             return
                         else :
-                            self.bail ( "Router A priority %d had %d messages instead of %d." %
-                                        (magic, message_count, self.n_messages) )
+                            self.bail("Router A priority %d had %d messages instead of %d." %
+                                      (magic, message_count, self.n_messages))
                             return
 
-        elif event.receiver == self.routers['B'] ['mgmt_receiver'] :
+        elif event.receiver == self.routers['B']['mgmt_receiver'] :
             # Router B has two sets of outgoing links, and it has not
             # set a priority for the target address. We should see all
             # of our messages going out over the message-intrinsic
@@ -450,23 +438,20 @@
                     priority      = result[3]
                     if role == "inter-router" and dir == "out" :
                         if priority == magic :
-                            message_counts.append ( message_count )
+                            message_counts.append(message_count)
 
                 if self.n_messages in message_counts :
-                    self.goal_satisfied ( )
+                    self.goal_satisfied()
                 else :
-                    self.bail ( "No outgoing link on router B had %d messages at priority 3" % self.n_messages )
+                    self.bail("No outgoing link on router B had %d messages at priority 3" % self.n_messages)
 
         else :
             # This is a payload message -- not management. Just count it.
             self.n_received += 1
 
-
     def run(self):
         Container(self).run()
 
 
-
-
 if __name__ == '__main__':
     unittest.main(main_module())
diff --git a/tests/system_tests_protocol_family.py b/tests/system_tests_protocol_family.py
index ec5de88..4ceb234 100644
--- a/tests/system_tests_protocol_family.py
+++ b/tests/system_tests_protocol_family.py
@@ -29,10 +29,10 @@
 from system_test import unittest
 from qpid_dispatch_internal.policy.policy_util import is_ipv6_enabled
 
+
 class ProtocolFamilyTest(TestCase):
     @classmethod
     def setUpClass(cls):
-
         """
         Starts three routers with various listeners and connectors.
         There is a call to wait_router_connected to make sure that the routers are able to communicate with each
@@ -43,7 +43,7 @@
         def router(name, connection):
 
             config = [
-                ('router', {'mode': 'interior', 'id': 'QDR.%s'%name}),
+                ('router', {'mode': 'interior', 'id': 'QDR.%s' % name}),
 
                 # No protocolFamily is specified for this listener.
                 # This will test if the router defaults host to 127.0.0.1 and if the router auto-detects protocol family
@@ -51,7 +51,7 @@
                 ('listener', {'port': cls.tester.get_port()}),
 
                 # Specify host as 127.0.0.1 and protocol family as IPv4
-                ('listener', {'host': '127.0.0.1', 'protocolFamily': 'IPv4','port': cls.tester.get_port()}),
+                ('listener', {'host': '127.0.0.1', 'protocolFamily': 'IPv4', 'port': cls.tester.get_port()}),
 
                 # Specify protocol family as IPv4 but don't specify any host
                 # This will test if the router defaults the host field to 127.0.0.1
@@ -85,23 +85,23 @@
                [
                    ('listener', {'host': '::1', 'role': 'inter-router', 'protocolFamily': 'IPv6', 'port': inter_router_port})
                ]
-        )
+               )
 
         router('B',
                [
                    # Tests an IPv6 connector
                    ('connector', {'host': '::1', 'role': 'inter-router', 'protocolFamily': 'IPv6', 'port': inter_router_port}),
                    ('listener', {'host': '127.0.0.1', 'role': 'inter-router', 'port': inter_router_ipv4_port})
-                ]
+               ]
 
-        )
+               )
 
         router('C',
                [
                    # Tests an IPv4 connector
                    ('connector', {'host': '127.0.0.1', 'role': 'inter-router', 'port': inter_router_ipv4_port})
                ]
-        )
+               )
         cls.routers[0].wait_router_connected('QDR.B')
         cls.routers[1].wait_router_connected('QDR.A')
         cls.routers[2].wait_router_connected('QDR.B')
diff --git a/tests/system_tests_protocol_settings.py b/tests/system_tests_protocol_settings.py
index 7ed3b9f..c32d548 100644
--- a/tests/system_tests_protocol_settings.py
+++ b/tests/system_tests_protocol_settings.py
@@ -28,6 +28,7 @@
 import subprocess
 import sys
 
+
 class MaxFrameMaxSessionFramesTest(TestCase):
     """System tests setting proton negotiated size max-frame-size and incoming-window"""
     @classmethod
@@ -384,7 +385,7 @@
         cls.routers[1].wait_router_connected('QDR.A')
 
     def test_connector_default(self):
-        with  open('../setUpClass/A.log', 'r') as router_log:
+        with open('../setUpClass/A.log', 'r') as router_log:
             log_lines = router_log.read().split("\n")
             open_lines = [s for s in log_lines if "<- @open" in s]
             # nondefaults
diff --git a/tests/system_tests_qdmanage.py b/tests/system_tests_qdmanage.py
index 8c1d4ab..210d49d 100644
--- a/tests/system_tests_qdmanage.py
+++ b/tests/system_tests_qdmanage.py
@@ -40,7 +40,7 @@
 
 CONNECTION_PROPERTIES_UNICODE_STRING = {u'connection': u'properties', u'int_property': 6451}
 
-TOTAL_ENTITIES=35   # for tests that check the total # of entities
+TOTAL_ENTITIES = 35   # for tests that check the total # of entities
 
 
 class QdmanageTest(TestCase):
@@ -57,10 +57,10 @@
         config_1 = Qdrouterd.Config([
             ('router', {'mode': 'interior', 'id': 'R1'}),
             ('sslProfile', {'name': 'server-ssl',
-                             'caCertFile': cls.ssl_file('ca-certificate.pem'),
-                             'certFile': cls.ssl_file('server-certificate.pem'),
-                             'privateKeyFile': cls.ssl_file('server-private-key.pem'),
-                             'password': 'server-password'}),
+                            'caCertFile': cls.ssl_file('ca-certificate.pem'),
+                            'certFile': cls.ssl_file('server-certificate.pem'),
+                            'privateKeyFile': cls.ssl_file('server-private-key.pem'),
+                            'password': 'server-password'}),
             ('listener', {'port': cls.tester.get_port()}),
 
             ('connector', {'role': 'inter-router', 'port': cls.inter_router_port}),
@@ -97,12 +97,14 @@
     def assert_entity_equal(self, expect, actual, copy=None):
         """Copy keys in copy from actual to idenity, then assert maps equal."""
         if copy:
-            for k in copy: expect[k] = actual[k]
+            for k in copy:
+                expect[k] = actual[k]
         self.assertEqual(expect, actual)
 
     def assert_entities_equal(self, expect, actual, copy=None):
         """Do assert_entities_equal on a list of maps."""
-        for e, a in zip(expect, actual): self.assert_entity_equal(e, a, copy)
+        for e, a in zip(expect, actual):
+            self.assert_entity_equal(e, a, copy)
 
     def test_crud(self):
 
@@ -156,7 +158,7 @@
     def test_query(self):
 
         def long_type(name):
-            return u'org.apache.qpid.dispatch.'+name
+            return u'org.apache.qpid.dispatch.' + name
 
         types = ['listener', 'log', 'router']
         long_types = [long_type(name) for name in types]
@@ -167,7 +169,7 @@
             self.assertIn(t, qall_types)
 
         qlistener = json.loads(self.run_qdmanage('query --type=listener'))
-        self.assertEqual([long_type('listener')]*2, [e['type'] for e in qlistener])
+        self.assertEqual([long_type('listener')] * 2, [e['type'] for e in qlistener])
         self.assertEqual(self.router_1.ports[0], int(qlistener[0]['port']))
 
         qattr = json.loads(self.run_qdmanage('query type name'))
@@ -249,15 +251,15 @@
         # Each value returned by the above query should be
         # a log, and each log should contain an entry for each
         # log level.
-        log_levels = [ 'criticalCount',
-                       'debugCount',
-                       'errorCount',
-                       'infoCount',
-                       'noticeCount',
-                       'traceCount',
-                       'warningCount'
-                     ]
-        n_log_levels = len ( log_levels )
+        log_levels = ['criticalCount',
+                      'debugCount',
+                      'errorCount',
+                      'infoCount',
+                      'noticeCount',
+                      'traceCount',
+                      'warningCount'
+                      ]
+        n_log_levels = len(log_levels)
 
         good_logs = 0
 
@@ -272,7 +274,7 @@
             if log_levels_present == n_log_levels:
                 good_logs += 1
 
-        self.assertEqual ( good_logs, len(logs) )
+        self.assertEqual(good_logs, len(logs))
 
     def test_update(self):
         exception = False
@@ -359,7 +361,6 @@
         self.assertEqual(output['dir'], 'out')
         self.assertEqual(output['direction'], 'out')
 
-
     def test_specify_container_id_connection_auto_link(self):
         long_type = 'org.apache.qpid.dispatch.router.config.autoLink'
         create_command = 'CREATE --type=' + long_type + ' addr=abc containerId=id1 connection=conn1 direction=out'
@@ -435,12 +436,12 @@
     def test_create_delete_ssl_profile(self):
         ssl_profile_name = 'ssl-profile-test'
         ssl_create_command = 'CREATE --type=sslProfile certFile=' + self.ssl_file('server-certificate.pem') + \
-                         ' privateKeyFile=' + self.ssl_file('server-private-key.pem') + ' password=server-password' + \
-                         ' name=' + ssl_profile_name + ' caCertFile=' + self.ssl_file('ca-certificate.pem')
+            ' privateKeyFile=' + self.ssl_file('server-private-key.pem') + ' password=server-password' + \
+            ' name=' + ssl_profile_name + ' caCertFile=' + self.ssl_file('ca-certificate.pem')
         output = json.loads(self.run_qdmanage(ssl_create_command))
         self.assertEqual(output['name'], ssl_profile_name)
         self.run_qdmanage('DELETE --type=sslProfile --name=' +
-        ssl_profile_name)
+                          ssl_profile_name)
 
     def test_delete_connection(self):
         """
@@ -482,9 +483,9 @@
         pcount = 0
         for p in config:
             query_command = 'CREATE --type=' + long_type + \
-                                             ' pattern=' + p[0] + \
-                                             ' distribution=' + p[1] + \
-                                             ' name=Pattern' + str(pcount)
+                ' pattern=' + p[0] + \
+                ' distribution=' + p[1] + \
+                ' name=Pattern' + str(pcount)
             self.run_qdmanage(query_command)
             pcount += 1
 
@@ -507,7 +508,7 @@
         pcount = 0
         for p in config:
             query_command = 'DELETE --type=' + long_type + \
-                                             ' --name=Pattern' + str(pcount)
+                ' --name=Pattern' + str(pcount)
             self.run_qdmanage(query_command)
             pcount += 1
 
@@ -585,7 +586,7 @@
                 self.logger.log("Test success!")
                 success = True
                 break
-                
+
         if not success:
             self.logger.dump()
 
diff --git a/tests/system_tests_qdstat.py b/tests/system_tests_qdstat.py
index a53f596..2282bdd 100644
--- a/tests/system_tests_qdstat.py
+++ b/tests/system_tests_qdstat.py
@@ -32,6 +32,7 @@
 from system_test import main_module, SkipIfNeeded
 from proton.utils import BlockingConnection
 
+
 class QdstatTest(system_test.TestCase):
     """Test qdstat tool output"""
     @classmethod
@@ -45,20 +46,21 @@
 
     def run_qdstat(self, args, regexp=None, address=None):
         if args:
-            popen_args = ['qdstat', '--bus', str(address or self.router.addresses[0]), '--timeout', str(system_test.TIMEOUT) ] + args
+            popen_args = ['qdstat', '--bus', str(address or self.router.addresses[0]), '--timeout', str(system_test.TIMEOUT)] + args
         else:
             popen_args = ['qdstat', '--bus',
                           str(address or self.router.addresses[0]),
                           '--timeout', str(system_test.TIMEOUT)]
 
         p = self.popen(popen_args,
-            name='qdstat-'+self.id(), stdout=PIPE, expect=None,
-            universal_newlines=True)
+                       name='qdstat-' + self.id(), stdout=PIPE, expect=None,
+                       universal_newlines=True)
 
         out = p.communicate()[0]
         assert p.returncode == 0, \
             "qdstat exit status %s, output:\n%s" % (p.returncode, out)
-        if regexp: assert re.search(regexp, out, re.I), "Can't find '%s' in '%s'" % (regexp, out)
+        if regexp:
+            assert re.search(regexp, out, re.I), "Can't find '%s' in '%s'" % (regexp, out)
         return out
 
     def test_help(self):
@@ -189,7 +191,7 @@
 
             # make sure the priority found is a hyphen or a legal number
             if pri[0] == '-':
-                pass # naked hypnen is allowed
+                pass  # naked hypnen is allowed
             else:
                 self.assertTrue(len(pri) > 0, "Can not find numeric priority in '%s'" % lines[i])
                 priority = int(pri[0])
@@ -213,11 +215,11 @@
         # extract the number in the priority column of every address
         for i in range(HEADER_ROW + 1, len(lines) - 1):
             line = lines[i].split(',')
-            pri = line[PRI_COL][1:-1] # unquoted value
+            pri = line[PRI_COL][1:-1]  # unquoted value
 
             # make sure the priority found is a hyphen or a legal number
             if pri == '-':
-                pass # naked hypnen is allowed
+                pass  # naked hypnen is allowed
             else:
                 priority = int(pri)
                 # make sure the priority is from -1 to 9
@@ -265,7 +267,7 @@
         self.assertIn("Total Denials", out)
 
     def test_log(self):
-        self.run_qdstat(['--log',  '--limit=5'], r'AGENT \(debug\).*GET-LOG')
+        self.run_qdstat(['--log', '--limit=5'], r'AGENT \(debug\).*GET-LOG')
 
     def test_yy_query_many_links(self):
         # This test will fail without the fix for DISPATCH-974
@@ -320,7 +322,6 @@
         self.assertEqual(in_links, COUNT)
         self.assertEqual(out_links, COUNT)
 
-
         # Run qdstat with a limit less than 10,000
         outs = self.run_qdstat(['--links', '--limit=2000'])
         out_list = outs.split("\n")
@@ -405,7 +406,7 @@
         for out in out_list:
             if "endpoint" in out and "examples" in out:
                 links += 1
-        self.assertEqual(links, COUNT*2)
+        self.assertEqual(links, COUNT * 2)
 
         # DISPATCH-1485. Try to run qdstat with a limit=0. Without the fix for DISPATCH-1485
         # this following command will hang and the test will fail.
@@ -417,8 +418,7 @@
         for out in out_list:
             if "endpoint" in out and "examples" in out:
                 links += 1
-        self.assertEqual(links, COUNT*2)
-
+        self.assertEqual(links, COUNT * 2)
 
         # This test would fail without the fix for DISPATCH-974
         outs = self.run_qdstat(['--address'])
@@ -491,20 +491,21 @@
 
     def run_qdstat(self, args, regexp=None, address=None):
         if args:
-            popen_args = ['qdstat', '--bus', str(address or self.router.addresses[0]), '--timeout', str(system_test.TIMEOUT) ] + args
+            popen_args = ['qdstat', '--bus', str(address or self.router.addresses[0]), '--timeout', str(system_test.TIMEOUT)] + args
         else:
             popen_args = ['qdstat', '--bus',
                           str(address or self.router.addresses[0]),
                           '--timeout', str(system_test.TIMEOUT)]
 
         p = self.popen(popen_args,
-            name='qdstat-'+self.id(), stdout=PIPE, expect=None,
-            universal_newlines=True)
+                       name='qdstat-' + self.id(), stdout=PIPE, expect=None,
+                       universal_newlines=True)
 
         out = p.communicate()[0]
         assert p.returncode == 0, \
             "qdstat exit status %s, output:\n%s" % (p.returncode, out)
-        if regexp: assert re.search(regexp, out, re.I), "Can't find '%s' in '%s'" % (regexp, out)
+        if regexp:
+            assert re.search(regexp, out, re.I), "Can't find '%s' in '%s'" % (regexp, out)
         return out
 
     def test_vhost(self):
@@ -546,8 +547,6 @@
         self.assertIn("remote hosts", out)
 
 
-
-
 class QdstatLinkPriorityTest(system_test.TestCase):
     """Need 2 routers to get inter-router links for the link priority test"""
     @classmethod
@@ -573,8 +572,8 @@
 
     def run_qdstat(self, args):
         p = self.popen(
-            ['qdstat', '--bus', str(self.address()), '--timeout', str(system_test.TIMEOUT) ] + args,
-            name='qdstat-'+self.id(), stdout=PIPE, expect=None,
+            ['qdstat', '--bus', str(self.address()), '--timeout', str(system_test.TIMEOUT)] + args,
+            name='qdstat-' + self.id(), stdout=PIPE, expect=None,
             universal_newlines=True)
 
         out = p.communicate()[0]
@@ -601,7 +600,7 @@
                 pri = re.findall(r'[-\d]+', lines[i][priority_column:])
                 # make sure the priority found is a number
                 self.assertTrue(len(pri) > 0, "Can not find numeric priority in '%s'" % lines[i])
-                self.assertTrue(pri[0] != '-') # naked hypen disallowed
+                self.assertTrue(pri[0] != '-')  # naked hypen disallowed
                 priority = int(pri[0])
                 # make sure the priority is from 0 to 9
                 self.assertTrue(priority >= 0, "Priority was less than 0")
@@ -613,7 +612,6 @@
         # make sure that all priorities are present in the list (currently 0-9)
         self.assertEqual(len(priorities.keys()), 10, "Not all priorities are present")
 
-
     def test_link_priority_csv(self):
         HEADER_ROW = 4
         TYPE_COL = 0
@@ -648,7 +646,6 @@
         # make sure that all priorities are present in the list (currently 0-9)
         self.assertEqual(len(priorities.keys()), 10, "Not all priorities are present")
 
-
     def _test_links_all_routers(self, command):
         out = self.run_qdstat(command)
 
@@ -663,7 +660,6 @@
     def test_links_all_routers_csv(self):
         self._test_links_all_routers(['--links', '--all-routers', '--csv'])
 
-
     def _test_all_entities(self, command):
         out = self.run_qdstat(command)
 
@@ -703,6 +699,7 @@
 
 try:
     SSLDomain(SSLDomain.MODE_CLIENT)
+
     class QdstatSslTest(system_test.TestCase):
         """Test qdstat tool output"""
 
@@ -727,10 +724,10 @@
                             'workerThreads': 1,
                             'saslConfigName': 'tests-mech-EXTERNAL'}),
                 ('sslProfile', {'name': 'server-ssl',
-                                 'caCertFile': cls.ssl_file('ca-certificate.pem'),
-                                 'certFile': cls.ssl_file('server-certificate.pem'),
-                                 'privateKeyFile': cls.ssl_file('server-private-key.pem'),
-                                 'password': 'server-password'}),
+                                'caCertFile': cls.ssl_file('ca-certificate.pem'),
+                                'certFile': cls.ssl_file('server-certificate.pem'),
+                                'privateKeyFile': cls.ssl_file('server-private-key.pem'),
+                                'password': 'server-password'}),
                 ('listener', {'port': cls.tester.get_port()}),
                 ('listener', {'port': cls.tester.get_port(), 'sslProfile': 'server-ssl', 'authenticatePeer': 'no', 'requireSsl': 'yes'}),
                 ('listener', {'port': cls.tester.get_port(), 'sslProfile': 'server-ssl', 'authenticatePeer': 'no', 'requireSsl': 'no'}),
@@ -742,24 +739,25 @@
         def run_qdstat(self, args, regexp=None, address=None):
             p = self.popen(
                 ['qdstat', '--bus', str(address or self.router.addresses[0]), '--ssl-disable-peer-name-verify',
-                 '--timeout', str(system_test.TIMEOUT) ] + args,
-                name='qdstat-'+self.id(), stdout=PIPE, expect=None,
+                 '--timeout', str(system_test.TIMEOUT)] + args,
+                name='qdstat-' + self.id(), stdout=PIPE, expect=None,
                 universal_newlines=True)
 
             out = p.communicate()[0]
             assert p.returncode == 0, \
                 "qdstat exit status %s, output:\n%s" % (p.returncode, out)
-            if regexp: assert re.search(regexp, out, re.I), "Can't find '%s' in '%s'" % (regexp, out)
+            if regexp:
+                assert re.search(regexp, out, re.I), "Can't find '%s' in '%s'" % (regexp, out)
             return out
 
         def get_ssl_args(self):
             args = dict(
-                sasl_external = ['--sasl-mechanisms', 'EXTERNAL'],
-                trustfile = ['--ssl-trustfile', self.ssl_file('ca-certificate.pem')],
-                bad_trustfile = ['--ssl-trustfile', self.ssl_file('bad-ca-certificate.pem')],
-                client_cert = ['--ssl-certificate', self.ssl_file('client-certificate.pem')],
-                client_key = ['--ssl-key', self.ssl_file('client-private-key.pem')],
-                client_pass = ['--ssl-password', 'client-password'])
+                sasl_external=['--sasl-mechanisms', 'EXTERNAL'],
+                trustfile=['--ssl-trustfile', self.ssl_file('ca-certificate.pem')],
+                bad_trustfile=['--ssl-trustfile', self.ssl_file('bad-ca-certificate.pem')],
+                client_cert=['--ssl-certificate', self.ssl_file('client-certificate.pem')],
+                client_key=['--ssl-key', self.ssl_file('client-private-key.pem')],
+                client_pass=['--ssl-password', 'client-password'])
             args['client_cert_all'] = args['client_cert'] + args['client_key'] + args['client_pass']
 
             return args
@@ -769,7 +767,7 @@
             See test_ssl_* below.
             """
             args = self.get_ssl_args()
-            addrs = [self.router.addresses[i] for i in range(4)];
+            addrs = [self.router.addresses[i] for i in range(4)]
             urls = dict(zip(['none', 'strict', 'unsecured', 'auth'], addrs))
             urls.update(zip(['none_s', 'strict_s', 'unsecured_s', 'auth_s'],
                             (Url(a, scheme="amqps") for a in addrs)))
@@ -809,8 +807,8 @@
         def test_ssl_bad_trustfile_to_strict(self):
             self.ssl_test_bad('strict_s', ['bad_trustfile'])
 
-
         # Require-auth SSL listener
+
         def test_ssl_none_to_auth(self):
             self.ssl_test_bad('auth', [])
 
@@ -832,8 +830,8 @@
         def test_ssl_cert_explicit_external_to_auth(self):
             self.ssl_test('auth_s', ['sasl_external', 'client_cert_all'])
 
-
         # Unsecured SSL listener, allows non-SSL
+
         def test_ssl_none_to_unsecured(self):
             self.ssl_test('unsecured', [])
 
@@ -859,18 +857,20 @@
 
 try:
     SSLDomain(SSLDomain.MODE_CLIENT)
+
     class QdstatSslTestSslPasswordFile(QdstatSslTest):
         """
         Tests the --ssl-password-file command line parameter
         """
+
         def get_ssl_args(self):
             args = dict(
-                sasl_external = ['--sasl-mechanisms', 'EXTERNAL'],
-                trustfile = ['--ssl-trustfile', self.ssl_file('ca-certificate.pem')],
-                bad_trustfile = ['--ssl-trustfile', self.ssl_file('bad-ca-certificate.pem')],
-                client_cert = ['--ssl-certificate', self.ssl_file('client-certificate.pem')],
-                client_key = ['--ssl-key', self.ssl_file('client-private-key.pem')],
-                client_pass = ['--ssl-password-file', self.ssl_file('client-password-file.txt')])
+                sasl_external=['--sasl-mechanisms', 'EXTERNAL'],
+                trustfile=['--ssl-trustfile', self.ssl_file('ca-certificate.pem')],
+                bad_trustfile=['--ssl-trustfile', self.ssl_file('bad-ca-certificate.pem')],
+                client_cert=['--ssl-certificate', self.ssl_file('client-certificate.pem')],
+                client_key=['--ssl-key', self.ssl_file('client-private-key.pem')],
+                client_pass=['--ssl-password-file', self.ssl_file('client-password-file.txt')])
             args['client_cert_all'] = args['client_cert'] + args['client_key'] + args['client_pass']
 
             return args
@@ -882,6 +882,7 @@
 
 try:
     SSLDomain(SSLDomain.MODE_CLIENT)
+
     class QdstatSslNoExternalTest(system_test.TestCase):
         """Test qdstat can't connect without sasl_mech EXTERNAL"""
 
@@ -906,10 +907,10 @@
                             'workerThreads': 1,
                             'saslConfigName': 'tests-mech-NOEXTERNAL'}),
                 ('sslProfile', {'name': 'server-ssl',
-                                 'caCertFile': cls.ssl_file('ca-certificate.pem'),
-                                 'certFile': cls.ssl_file('server-certificate.pem'),
-                                 'privateKeyFile': cls.ssl_file('server-private-key.pem'),
-                                 'password': 'server-password'}),
+                                'caCertFile': cls.ssl_file('ca-certificate.pem'),
+                                'certFile': cls.ssl_file('server-certificate.pem'),
+                                'privateKeyFile': cls.ssl_file('server-private-key.pem'),
+                                'password': 'server-password'}),
                 ('listener', {'port': cls.tester.get_port()}),
                 ('listener', {'port': cls.tester.get_port(), 'sslProfile': 'server-ssl', 'authenticatePeer': 'no', 'requireSsl': 'yes'}),
                 ('listener', {'port': cls.tester.get_port(), 'sslProfile': 'server-ssl', 'authenticatePeer': 'no', 'requireSsl': 'no'}),
@@ -920,13 +921,14 @@
 
         def run_qdstat(self, args, regexp=None, address=None):
             p = self.popen(
-                ['qdstat', '--bus', str(address or self.router.addresses[0]), '--timeout', str(system_test.TIMEOUT) ] + args,
-                name='qdstat-'+self.id(), stdout=PIPE, expect=None,
+                ['qdstat', '--bus', str(address or self.router.addresses[0]), '--timeout', str(system_test.TIMEOUT)] + args,
+                name='qdstat-' + self.id(), stdout=PIPE, expect=None,
                 universal_newlines=True)
             out = p.communicate()[0]
             assert p.returncode == 0, \
                 "qdstat exit status %s, output:\n%s" % (p.returncode, out)
-            if regexp: assert re.search(regexp, out, re.I), "Can't find '%s' in '%s'" % (regexp, out)
+            if regexp:
+                assert re.search(regexp, out, re.I), "Can't find '%s' in '%s'" % (regexp, out)
             return out
 
         def ssl_test(self, url_name, arg_names):
@@ -934,14 +936,14 @@
             See test_ssl_* below.
             """
             args = dict(
-                trustfile = ['--ssl-trustfile', self.ssl_file('ca-certificate.pem')],
-                bad_trustfile = ['--ssl-trustfile', self.ssl_file('bad-ca-certificate.pem')],
-                client_cert = ['--ssl-certificate', self.ssl_file('client-certificate.pem')],
-                client_key = ['--ssl-key', self.ssl_file('client-private-key.pem')],
-                client_pass = ['--ssl-password', 'client-password'])
+                trustfile=['--ssl-trustfile', self.ssl_file('ca-certificate.pem')],
+                bad_trustfile=['--ssl-trustfile', self.ssl_file('bad-ca-certificate.pem')],
+                client_cert=['--ssl-certificate', self.ssl_file('client-certificate.pem')],
+                client_key=['--ssl-key', self.ssl_file('client-private-key.pem')],
+                client_pass=['--ssl-password', 'client-password'])
             args['client_cert_all'] = args['client_cert'] + args['client_key'] + args['client_pass']
 
-            addrs = [self.router.addresses[i] for i in range(4)];
+            addrs = [self.router.addresses[i] for i in range(4)]
             urls = dict(zip(['none', 'strict', 'unsecured', 'auth'], addrs))
             urls.update(zip(['none_s', 'strict_s', 'unsecured_s', 'auth_s'],
                             (Url(a, scheme="amqps") for a in addrs)))
diff --git a/tests/system_tests_router_mesh.py b/tests/system_tests_router_mesh.py
index 6d7418a..6b65d73 100644
--- a/tests/system_tests_router_mesh.py
+++ b/tests/system_tests_router_mesh.py
@@ -157,7 +157,6 @@
         """
         self._rx_failover()
 
-
     def test_02_rx_failover_dirty(self):
         """
         Runs the receiver failover test.  In this test the receiver abruptly
diff --git a/tests/system_tests_routing_protocol.py b/tests/system_tests_routing_protocol.py
index 07a929a..466122c 100644
--- a/tests/system_tests_routing_protocol.py
+++ b/tests/system_tests_routing_protocol.py
@@ -62,7 +62,6 @@
         cls.routers[0].wait_router_connected('B')
         cls.routers[1].wait_router_connected('A')
 
-
     def test_01_reject_higher_version_hello(self):
         test = RejectHigherVersionHelloTest(self.routers[0].addresses[3])
         test.run()
@@ -121,7 +120,7 @@
 
             hello = Message(address='_local/qdhello',
                             properties={'opcode': 'HELLO'},
-                            body={'id':'TEST', 'pv':int32(2), 'area':'0', 'instance':100, 'seen':[rid]})
+                            body={'id': 'TEST', 'pv': int32(2), 'area': '0', 'instance': 100, 'seen': [rid]})
             dlv = self.sender.send(hello)
             dlv.settle()
 
@@ -159,7 +158,7 @@
         self.normal_conn = event.container.connect(self.normal_host)
 
         ##
-        ## Attach a mobile address to cause mobile_Seq to be bumped
+        # Attach a mobile address to cause mobile_Seq to be bumped
         ##
         self.mobile_receiver = event.container.create_receiver(self.normal_conn, "mobile_address")
 
@@ -181,9 +180,9 @@
         if opcode == 'HELLO':
             self.hello_count += 1
 
-            hello = Message(address='_local/qdhello', 
+            hello = Message(address='_local/qdhello',
                             properties={'opcode': 'HELLO'},
-                            body={'id':'TEST', 'pv':int32(1), 'area':'0', 'instance':100, 'seen':[rid]})
+                            body={'id': 'TEST', 'pv': int32(1), 'area': '0', 'instance': 100, 'seen': [rid]})
             dlv = self.sender.send(hello)
             dlv.settle()
 
@@ -194,7 +193,7 @@
 
             mar = Message(address='_topo/0/%s/qdrouter.ma' % rid,
                           properties={'opcode': 'MAR'},
-                          body={'id':'TEST', 'pv':int32(2), 'area':'0', 'have_seq':int32(0)})
+                          body={'id': 'TEST', 'pv': int32(2), 'area': '0', 'have_seq': int32(0)})
             dlv = self.sender.send(mar)
             dlv.settle()
             self.mar_count += 1
diff --git a/tests/system_tests_sasl_plain.py b/tests/system_tests_sasl_plain.py
index 1e5bfeb..aa84a6f 100644
--- a/tests/system_tests_sasl_plain.py
+++ b/tests/system_tests_sasl_plain.py
@@ -23,13 +23,15 @@
 from __future__ import print_function
 
 from time import sleep
-import os, json
+import os
+import json
 from subprocess import PIPE, STDOUT, Popen
 from system_test import TestCase, Qdrouterd, main_module, DIR, TIMEOUT, SkipIfNeeded, Process
 from system_test import unittest, QdManager
 from qpid_dispatch.management.client import Node
 from proton import SASL
 
+
 class RouterTestPlainSaslCommon(TestCase):
     @classmethod
     def router(cls, name, connection):
@@ -64,7 +66,6 @@
     def sasl_file(name):
         return os.path.join(DIR, 'sasl_files', name)
 
-
     @classmethod
     def setUpClass(cls):
         """
@@ -88,32 +89,32 @@
         y_listener_port = cls.tester.get_port()
 
         super(RouterTestPlainSaslFailure, cls).router('X', [
-                     ('listener', {'host': '0.0.0.0', 'role': 'inter-router', 'port': x_listener_port,
-                                   'saslMechanisms':'PLAIN', 'authenticatePeer': 'yes'}),
-                     # This unauthenticated listener is for qdstat to connect to it.
-                     ('listener', {'host': '0.0.0.0', 'role': 'normal', 'port': cls.tester.get_port(),
-                                   'authenticatePeer': 'no'}),
-                     ('listener', {'host': '0.0.0.0', 'role': 'normal', 'port': cls.tester.get_port(),
-                                   'saslMechanisms':'PLAIN', 'authenticatePeer': 'yes'}),
-                     ('router', {'workerThreads': 1,
-                                 'id': 'QDR.X',
-                                 'mode': 'interior',
-                                 'saslConfigName': 'tests-mech-PLAIN',
-                                 # Leave as saslConfigPath for testing backward compatibility
-                                 'saslConfigPath': os.getcwd()}),
+            ('listener', {'host': '0.0.0.0', 'role': 'inter-router', 'port': x_listener_port,
+                          'saslMechanisms': 'PLAIN', 'authenticatePeer': 'yes'}),
+            # This unauthenticated listener is for qdstat to connect to it.
+            ('listener', {'host': '0.0.0.0', 'role': 'normal', 'port': cls.tester.get_port(),
+                          'authenticatePeer': 'no'}),
+            ('listener', {'host': '0.0.0.0', 'role': 'normal', 'port': cls.tester.get_port(),
+                          'saslMechanisms': 'PLAIN', 'authenticatePeer': 'yes'}),
+            ('router', {'workerThreads': 1,
+                        'id': 'QDR.X',
+                        'mode': 'interior',
+                        'saslConfigName': 'tests-mech-PLAIN',
+                        # Leave as saslConfigPath for testing backward compatibility
+                        'saslConfigPath': os.getcwd()}),
         ])
 
         super(RouterTestPlainSaslFailure, cls).router('Y', [
-                     ('connector', {'host': '0.0.0.0', 'role': 'inter-router', 'port': x_listener_port,
-                                    # Provide a sasl user name and password to connect to QDR.X
-                                   'saslMechanisms': 'PLAIN',
-                                    'saslUsername': 'test@domain.com',
-                                    # Provide a non-existen file.
-                                    'saslPassword': 'file:' + cls.sasl_file('non-existent-password-file.txt')}),
-                     ('router', {'workerThreads': 1,
-                                 'mode': 'interior',
-                                 'id': 'QDR.Y'}),
-                     ('listener', {'host': '0.0.0.0', 'role': 'normal', 'port': y_listener_port}),
+            ('connector', {'host': '0.0.0.0', 'role': 'inter-router', 'port': x_listener_port,
+                           # Provide a sasl user name and password to connect to QDR.X
+                           'saslMechanisms': 'PLAIN',
+                           'saslUsername': 'test@domain.com',
+                           # Provide a non-existen file.
+                           'saslPassword': 'file:' + cls.sasl_file('non-existent-password-file.txt')}),
+            ('router', {'workerThreads': 1,
+                        'mode': 'interior',
+                        'id': 'QDR.Y'}),
+            ('listener', {'host': '0.0.0.0', 'role': 'normal', 'port': y_listener_port}),
         ])
 
         cls.routers[0].wait_ports()
@@ -161,7 +162,6 @@
     def sasl_file(name):
         return os.path.join(DIR, 'sasl_files', name)
 
-
     @classmethod
     def setUpClass(cls):
         """
@@ -185,32 +185,32 @@
         y_listener_port = cls.tester.get_port()
 
         super(RouterTestPlainSaslFailureUsingLiteral, cls).router('X', [
-                     ('listener', {'host': '0.0.0.0', 'role': 'inter-router', 'port': x_listener_port,
-                                   'saslMechanisms':'PLAIN', 'authenticatePeer': 'yes'}),
-                     # This unauthenticated listener is for qdstat to connect to it.
-                     ('listener', {'host': '0.0.0.0', 'role': 'normal', 'port': cls.tester.get_port(),
-                                   'authenticatePeer': 'no'}),
-                     ('listener', {'host': '0.0.0.0', 'role': 'normal', 'port': cls.tester.get_port(),
-                                   'saslMechanisms':'PLAIN', 'authenticatePeer': 'yes'}),
-                     ('router', {'workerThreads': 1,
-                                 'id': 'QDR.X',
-                                 'mode': 'interior',
-                                 'saslConfigName': 'tests-mech-PLAIN',
-                                 # Leave as saslConfigPath for testing backward compatibility
-                                 'saslConfigPath': os.getcwd()}),
+            ('listener', {'host': '0.0.0.0', 'role': 'inter-router', 'port': x_listener_port,
+                          'saslMechanisms': 'PLAIN', 'authenticatePeer': 'yes'}),
+            # This unauthenticated listener is for qdstat to connect to it.
+            ('listener', {'host': '0.0.0.0', 'role': 'normal', 'port': cls.tester.get_port(),
+                          'authenticatePeer': 'no'}),
+            ('listener', {'host': '0.0.0.0', 'role': 'normal', 'port': cls.tester.get_port(),
+                          'saslMechanisms': 'PLAIN', 'authenticatePeer': 'yes'}),
+            ('router', {'workerThreads': 1,
+                        'id': 'QDR.X',
+                        'mode': 'interior',
+                        'saslConfigName': 'tests-mech-PLAIN',
+                        # Leave as saslConfigPath for testing backward compatibility
+                        'saslConfigPath': os.getcwd()}),
         ])
 
         super(RouterTestPlainSaslFailureUsingLiteral, cls).router('Y', [
-                     ('connector', {'host': '0.0.0.0', 'role': 'inter-router', 'port': x_listener_port,
-                                    # Provide a sasl user name and password to connect to QDR.X
-                                   'saslMechanisms': 'PLAIN',
-                                    'saslUsername': 'test@domain.com',
-                                    # Provide the password with a prefix of literal. This should fail..
-                                    'saslPassword': 'literal:password'}),
-                     ('router', {'workerThreads': 1,
-                                 'mode': 'interior',
-                                 'id': 'QDR.Y'}),
-                     ('listener', {'host': '0.0.0.0', 'role': 'normal', 'port': y_listener_port}),
+            ('connector', {'host': '0.0.0.0', 'role': 'inter-router', 'port': x_listener_port,
+                           # Provide a sasl user name and password to connect to QDR.X
+                           'saslMechanisms': 'PLAIN',
+                           'saslUsername': 'test@domain.com',
+                           # Provide the password with a prefix of literal. This should fail..
+                           'saslPassword': 'literal:password'}),
+            ('router', {'workerThreads': 1,
+                        'mode': 'interior',
+                        'id': 'QDR.Y'}),
+            ('listener', {'host': '0.0.0.0', 'role': 'normal', 'port': y_listener_port}),
         ])
 
         cls.routers[0].wait_ports()
@@ -275,31 +275,31 @@
         y_listener_port = cls.tester.get_port()
 
         super(RouterTestPlainSasl, cls).router('X', [
-                     ('listener', {'host': '0.0.0.0', 'role': 'inter-router', 'port': x_listener_port,
-                                   'saslMechanisms':'PLAIN', 'authenticatePeer': 'yes'}),
-                     # This unauthenticated listener is for qdstat to connect to it.
-                     ('listener', {'host': '0.0.0.0', 'role': 'normal', 'port': cls.tester.get_port(),
-                                   'authenticatePeer': 'no'}),
-                     ('listener', {'host': '0.0.0.0', 'role': 'normal', 'port': cls.tester.get_port(),
-                                   'saslMechanisms':'PLAIN', 'authenticatePeer': 'yes'}),
-                     ('router', {'workerThreads': 1,
-                                 'id': 'QDR.X',
-                                 'mode': 'interior',
-                                 'saslConfigName': 'tests-mech-PLAIN',
-                                 # Leave as saslConfigPath for testing backward compatibility
-                                 'saslConfigPath': os.getcwd()}),
+            ('listener', {'host': '0.0.0.0', 'role': 'inter-router', 'port': x_listener_port,
+                          'saslMechanisms': 'PLAIN', 'authenticatePeer': 'yes'}),
+            # This unauthenticated listener is for qdstat to connect to it.
+            ('listener', {'host': '0.0.0.0', 'role': 'normal', 'port': cls.tester.get_port(),
+                          'authenticatePeer': 'no'}),
+            ('listener', {'host': '0.0.0.0', 'role': 'normal', 'port': cls.tester.get_port(),
+                          'saslMechanisms': 'PLAIN', 'authenticatePeer': 'yes'}),
+            ('router', {'workerThreads': 1,
+                        'id': 'QDR.X',
+                        'mode': 'interior',
+                        'saslConfigName': 'tests-mech-PLAIN',
+                        # Leave as saslConfigPath for testing backward compatibility
+                        'saslConfigPath': os.getcwd()}),
         ])
 
         super(RouterTestPlainSasl, cls).router('Y', [
-                     ('connector', {'host': '0.0.0.0', 'role': 'inter-router', 'port': x_listener_port,
-                                    # Provide a sasl user name and password to connect to QDR.X
-                                   'saslMechanisms': 'PLAIN',
-                                    'saslUsername': 'test@domain.com',
-                                    'saslPassword': 'env:ENV_SASL_PASSWORD'}),
-                     ('router', {'workerThreads': 1,
-                                 'mode': 'interior',
-                                 'id': 'QDR.Y'}),
-                     ('listener', {'host': '0.0.0.0', 'role': 'normal', 'port': y_listener_port}),
+            ('connector', {'host': '0.0.0.0', 'role': 'inter-router', 'port': x_listener_port,
+                           # Provide a sasl user name and password to connect to QDR.X
+                           'saslMechanisms': 'PLAIN',
+                           'saslUsername': 'test@domain.com',
+                           'saslPassword': 'env:ENV_SASL_PASSWORD'}),
+            ('router', {'workerThreads': 1,
+                        'mode': 'interior',
+                        'id': 'QDR.Y'}),
+            ('listener', {'host': '0.0.0.0', 'role': 'normal', 'port': y_listener_port}),
         ])
 
         cls.routers[1].wait_router_connected('QDR.X')
@@ -318,7 +318,7 @@
 
         p = self.popen(
             ['qdstat', '-b', str(self.routers[0].addresses[1]), '-c'],
-            name='qdstat-'+self.id(), stdout=PIPE, expect=None,
+            name='qdstat-' + self.id(), stdout=PIPE, expect=None,
             universal_newlines=True)
         out = p.communicate()[0]
         assert p.returncode == 0, \
@@ -336,7 +336,7 @@
         p = self.popen(
             ['qdstat', '-b', str(self.routers[0].addresses[2]), '-c', '--sasl-mechanisms=PLAIN',
              '--sasl-username=test@domain.com', '--sasl-password=password'],
-            name='qdstat-'+self.id(), stdout=PIPE, expect=None,
+            name='qdstat-' + self.id(), stdout=PIPE, expect=None,
             universal_newlines=True)
 
         out = p.communicate()[0]
@@ -366,7 +366,7 @@
         p = self.popen(
             ['qdstat', '-b', str(self.routers[0].addresses[2]), '-c', '--sasl-mechanisms=PLAIN',
              '--sasl-username=test@domain.com', '--sasl-password-file=' + password_file],
-            name='qdstat-'+self.id(), stdout=PIPE, expect=None,
+            name='qdstat-' + self.id(), stdout=PIPE, expect=None,
             universal_newlines=True)
 
         out = p.communicate()[0]
@@ -415,42 +415,42 @@
         y_listener_port = cls.tester.get_port()
 
         super(RouterTestPlainSaslOverSsl, cls).router('X', [
-                     ('listener', {'host': '0.0.0.0', 'role': 'inter-router', 'port': x_listener_port,
-                                   'sslProfile':'server-ssl-profile',
-                                   'saslMechanisms':'PLAIN', 'authenticatePeer': 'yes'}),
-                     ('listener', {'host': '0.0.0.0', 'role': 'normal', 'port': cls.tester.get_port(),
-                                   'authenticatePeer': 'no'}),
-                     ('listener', {'host': '0.0.0.0', 'role': 'normal', 'port': cls.tester.get_port(),
-                                   'sslProfile':'server-ssl-profile',
-                                   'saslMechanisms':'PLAIN', 'authenticatePeer': 'yes'}),
-                     ('sslProfile', {'name': 'server-ssl-profile',
-                                     'certFile': cls.ssl_file('server-certificate.pem'),
-                                     'privateKeyFile': cls.ssl_file('server-private-key.pem'),
-                                     'ciphers': 'ECDH+AESGCM:DH+AESGCM:ECDH+AES256:DH+AES256:ECDH+AES128:DH+AES:RSA+AESGCM:RSA+AES:!aNULL:!MD5:!DSS',
-                                     'protocols': 'TLSv1.1 TLSv1.2',
-                                     'password': 'server-password'}),
-                     ('router', {'workerThreads': 1,
-                                 'id': 'QDR.X',
-                                 'mode': 'interior',
-                                 'saslConfigName': 'tests-mech-PLAIN',
-                                 'saslConfigDir': os.getcwd()}),
+            ('listener', {'host': '0.0.0.0', 'role': 'inter-router', 'port': x_listener_port,
+                          'sslProfile': 'server-ssl-profile',
+                          'saslMechanisms': 'PLAIN', 'authenticatePeer': 'yes'}),
+            ('listener', {'host': '0.0.0.0', 'role': 'normal', 'port': cls.tester.get_port(),
+                          'authenticatePeer': 'no'}),
+            ('listener', {'host': '0.0.0.0', 'role': 'normal', 'port': cls.tester.get_port(),
+                          'sslProfile': 'server-ssl-profile',
+                          'saslMechanisms': 'PLAIN', 'authenticatePeer': 'yes'}),
+            ('sslProfile', {'name': 'server-ssl-profile',
+                            'certFile': cls.ssl_file('server-certificate.pem'),
+                            'privateKeyFile': cls.ssl_file('server-private-key.pem'),
+                            'ciphers': 'ECDH+AESGCM:DH+AESGCM:ECDH+AES256:DH+AES256:ECDH+AES128:DH+AES:RSA+AESGCM:RSA+AES:!aNULL:!MD5:!DSS',
+                            'protocols': 'TLSv1.1 TLSv1.2',
+                            'password': 'server-password'}),
+            ('router', {'workerThreads': 1,
+                        'id': 'QDR.X',
+                        'mode': 'interior',
+                        'saslConfigName': 'tests-mech-PLAIN',
+                        'saslConfigDir': os.getcwd()}),
         ])
 
         super(RouterTestPlainSaslOverSsl, cls).router('Y', [
-                     # This router will act like a client. First an SSL connection will be established and then
-                     # we will have SASL plain authentication over SSL.
-                     ('connector', {'host': 'localhost', 'role': 'inter-router', 'port': x_listener_port,
-                                    'sslProfile': 'client-ssl-profile',
-                                    # Provide a sasl user name and password to connect to QDR.X
-                                    'saslMechanisms': 'PLAIN',
-                                    'saslUsername': 'test@domain.com',
-                                    'saslPassword': 'file:' + cls.sasl_file('password.txt')}),
-                     ('router', {'workerThreads': 1,
-                                 'mode': 'interior',
-                                 'id': 'QDR.Y'}),
-                     ('listener', {'host': '0.0.0.0', 'role': 'normal', 'port': y_listener_port}),
-                     ('sslProfile', {'name': 'client-ssl-profile',
-                                     'caCertFile': cls.ssl_file('ca-certificate.pem')}),
+            # This router will act like a client. First an SSL connection will be established and then
+            # we will have SASL plain authentication over SSL.
+            ('connector', {'host': 'localhost', 'role': 'inter-router', 'port': x_listener_port,
+                           'sslProfile': 'client-ssl-profile',
+                           # Provide a sasl user name and password to connect to QDR.X
+                           'saslMechanisms': 'PLAIN',
+                           'saslUsername': 'test@domain.com',
+                           'saslPassword': 'file:' + cls.sasl_file('password.txt')}),
+            ('router', {'workerThreads': 1,
+                        'mode': 'interior',
+                        'id': 'QDR.Y'}),
+            ('listener', {'host': '0.0.0.0', 'role': 'normal', 'port': y_listener_port}),
+            ('sslProfile', {'name': 'client-ssl-profile',
+                            'caCertFile': cls.ssl_file('ca-certificate.pem')}),
         ])
 
         cls.routers[1].wait_router_connected('QDR.X')
@@ -472,7 +472,7 @@
              '--ssl-certificate=' + self.ssl_file('client-certificate.pem'),
              '--ssl-key=' + self.ssl_file('client-private-key.pem'),
              '--ssl-password=client-password'],
-            name='qdstat-'+self.id(), stdout=PIPE, expect=None,
+            name='qdstat-' + self.id(), stdout=PIPE, expect=None,
             universal_newlines=True)
 
         out = p.communicate()[0]
@@ -545,38 +545,38 @@
         y_listener_port = cls.tester.get_port()
 
         super(RouterTestVerifyHostNameYes, cls).router('X', [
-                     ('listener', {'host': '0.0.0.0', 'role': 'inter-router', 'port': x_listener_port,
-                                   'sslProfile':'server-ssl-profile',
-                                   'saslMechanisms':'PLAIN', 'authenticatePeer': 'yes'}),
-                     # This unauthenticated listener is for qdstat to connect to it.
-                     ('listener', {'host': '0.0.0.0', 'role': 'normal', 'port': cls.tester.get_port(),
-                                   'authenticatePeer': 'no'}),
-                     ('sslProfile', {'name': 'server-ssl-profile',
-                                     'certFile': cls.ssl_file('server-certificate.pem'),
-                                     'privateKeyFile': cls.ssl_file('server-private-key.pem'),
-                                     'password': 'server-password'}),
-                     ('router', {'workerThreads': 1,
-                                 'id': 'QDR.X',
-                                 'mode': 'interior',
-                                 'saslConfigName': 'tests-mech-PLAIN',
-                                 'saslConfigDir': os.getcwd()}),
+            ('listener', {'host': '0.0.0.0', 'role': 'inter-router', 'port': x_listener_port,
+                          'sslProfile': 'server-ssl-profile',
+                          'saslMechanisms': 'PLAIN', 'authenticatePeer': 'yes'}),
+            # This unauthenticated listener is for qdstat to connect to it.
+            ('listener', {'host': '0.0.0.0', 'role': 'normal', 'port': cls.tester.get_port(),
+                          'authenticatePeer': 'no'}),
+            ('sslProfile', {'name': 'server-ssl-profile',
+                            'certFile': cls.ssl_file('server-certificate.pem'),
+                            'privateKeyFile': cls.ssl_file('server-private-key.pem'),
+                            'password': 'server-password'}),
+            ('router', {'workerThreads': 1,
+                        'id': 'QDR.X',
+                        'mode': 'interior',
+                        'saslConfigName': 'tests-mech-PLAIN',
+                        'saslConfigDir': os.getcwd()}),
         ])
 
         super(RouterTestVerifyHostNameYes, cls).router('Y', [
-                     ('connector', {'host': '127.0.0.1', 'role': 'inter-router', 'port': x_listener_port,
-                                    'sslProfile': 'client-ssl-profile',
-                                    # verifyHostName has been deprecated. We are using it here to test
-                                    # backward compatibility. TODO: should add a specific test.
-                                    'verifyHostName': 'yes',
-                                    'saslMechanisms': 'PLAIN',
-                                    'saslUsername': 'test@domain.com',
-                                    'saslPassword': 'file:' + cls.sasl_file('password.txt')}),
-                     ('router', {'workerThreads': 1,
-                                 'mode': 'interior',
-                                 'id': 'QDR.Y'}),
-                     ('listener', {'host': '0.0.0.0', 'role': 'normal', 'port': y_listener_port}),
-                     ('sslProfile', {'name': 'client-ssl-profile',
-                                     'caCertFile': cls.ssl_file('ca-certificate.pem')}),
+            ('connector', {'host': '127.0.0.1', 'role': 'inter-router', 'port': x_listener_port,
+                           'sslProfile': 'client-ssl-profile',
+                           # verifyHostName has been deprecated. We are using it here to test
+                           # backward compatibility. TODO: should add a specific test.
+                           'verifyHostName': 'yes',
+                           'saslMechanisms': 'PLAIN',
+                           'saslUsername': 'test@domain.com',
+                           'saslPassword': 'file:' + cls.sasl_file('password.txt')}),
+            ('router', {'workerThreads': 1,
+                        'mode': 'interior',
+                        'id': 'QDR.Y'}),
+            ('listener', {'host': '0.0.0.0', 'role': 'normal', 'port': y_listener_port}),
+            ('sslProfile', {'name': 'client-ssl-profile',
+                            'caCertFile': cls.ssl_file('ca-certificate.pem')}),
         ])
 
         cls.routers[0].wait_ports()
@@ -606,6 +606,7 @@
         self.assertEqual('normal', results[1].role)
         self.assertEqual('anonymous', results[1].user)
 
+
 class RouterTestVerifyHostNameNo(RouterTestPlainSaslCommon):
 
     @staticmethod
@@ -636,44 +637,44 @@
         y_listener_port = cls.tester.get_port()
 
         super(RouterTestVerifyHostNameNo, cls).router('X', [
-                     ('listener', {'host': '0.0.0.0', 'role': 'inter-router', 'port': x_listener_port,
-                                   'sslProfile':'server-ssl-profile',
-                                   'saslMechanisms':'PLAIN', 'authenticatePeer': 'yes'}),
-                     # This unauthenticated listener is for qdstat to connect to it.
-                     ('listener', {'host': '0.0.0.0', 'role': 'normal', 'port': cls.tester.get_port(),
-                                   'authenticatePeer': 'no'}),
-                     ('sslProfile', {'name': 'server-ssl-profile',
-                                     # certDb has been deprecated. We are using it here to test backward compatibility.
-                                     # TODO: should add a specific test, this one presumably doesnt even use it due to not doing client-certificate authentication
-                                     'certDb': cls.ssl_file('ca-certificate.pem'),
-                                     'certFile': cls.ssl_file('server-certificate.pem'),
-                                     # keyFile has been deprecated. We are using it here to test backward compatibility.
-                                     'keyFile': cls.ssl_file('server-private-key.pem'),
-                                     'password': 'server-password'}),
-                     ('router', {'workerThreads': 1,
-                                 'id': 'QDR.X',
-                                 'mode': 'interior',
-                                 'saslConfigName': 'tests-mech-PLAIN',
-                                 'saslConfigDir': os.getcwd()}),
+            ('listener', {'host': '0.0.0.0', 'role': 'inter-router', 'port': x_listener_port,
+                          'sslProfile': 'server-ssl-profile',
+                          'saslMechanisms': 'PLAIN', 'authenticatePeer': 'yes'}),
+            # This unauthenticated listener is for qdstat to connect to it.
+            ('listener', {'host': '0.0.0.0', 'role': 'normal', 'port': cls.tester.get_port(),
+                          'authenticatePeer': 'no'}),
+            ('sslProfile', {'name': 'server-ssl-profile',
+                            # certDb has been deprecated. We are using it here to test backward compatibility.
+                            # TODO: should add a specific test, this one presumably doesnt even use it due to not doing client-certificate authentication
+                            'certDb': cls.ssl_file('ca-certificate.pem'),
+                            'certFile': cls.ssl_file('server-certificate.pem'),
+                            # keyFile has been deprecated. We are using it here to test backward compatibility.
+                            'keyFile': cls.ssl_file('server-private-key.pem'),
+                            'password': 'server-password'}),
+            ('router', {'workerThreads': 1,
+                        'id': 'QDR.X',
+                        'mode': 'interior',
+                        'saslConfigName': 'tests-mech-PLAIN',
+                        'saslConfigDir': os.getcwd()}),
         ])
 
         super(RouterTestVerifyHostNameNo, cls).router('Y', [
-                     # This router will act like a client. First an SSL connection will be established and then
-                     # we will have SASL plain authentication over SSL.
-                     ('connector', {'name': 'connectorToX',
-                                    'host': '127.0.0.1', 'role': 'inter-router',
-                                    'port': x_listener_port,
-                                    'sslProfile': 'client-ssl-profile',
-                                    # Provide a sasl user name and password to connect to QDR.X
-                                    'saslMechanisms': 'PLAIN',
-                                    'verifyHostname': 'no',
-                                    'saslUsername': 'test@domain.com', 'saslPassword': 'pass:password'}),
-                     ('router', {'workerThreads': 1,
-                                 'mode': 'interior',
-                                 'id': 'QDR.Y'}),
-                     ('listener', {'host': '0.0.0.0', 'role': 'normal', 'port': y_listener_port}),
-                     ('sslProfile', {'name': 'client-ssl-profile',
-                                     'caCertFile': cls.ssl_file('ca-certificate.pem')}),
+            # This router will act like a client. First an SSL connection will be established and then
+            # we will have SASL plain authentication over SSL.
+            ('connector', {'name': 'connectorToX',
+                           'host': '127.0.0.1', 'role': 'inter-router',
+                           'port': x_listener_port,
+                           'sslProfile': 'client-ssl-profile',
+                           # Provide a sasl user name and password to connect to QDR.X
+                           'saslMechanisms': 'PLAIN',
+                           'verifyHostname': 'no',
+                           'saslUsername': 'test@domain.com', 'saslPassword': 'pass:password'}),
+            ('router', {'workerThreads': 1,
+                        'mode': 'interior',
+                        'id': 'QDR.Y'}),
+            ('listener', {'host': '0.0.0.0', 'role': 'normal', 'port': y_listener_port}),
+            ('sslProfile', {'name': 'client-ssl-profile',
+                            'caCertFile': cls.ssl_file('ca-certificate.pem')}),
         ])
 
         cls.routers[0].wait_ports()
@@ -727,31 +728,31 @@
         local_node = self.routers[1].management
 
         connections = local_node.query(type='org.apache.qpid.dispatch.connection').get_entities()
-        self.assertIn("QDR.X", [c.container for c in connections]) # We can find the connection before
+        self.assertIn("QDR.X", [c.container for c in connections])  # We can find the connection before
         local_node.delete(type='connector', name='connectorToX')
         local_node.delete(type='sslProfile', name='client-ssl-profile')
         connections = local_node.query(type='org.apache.qpid.dispatch.connection').get_entities()
         is_qdr_x = "QDR.X" in [c.container for c in connections]
-        self.assertFalse(is_qdr_x) # Should not be present now
+        self.assertFalse(is_qdr_x)  # Should not be present now
 
         # re-create the ssl profile
         local_node.create({'type': 'sslProfile',
-                     'name': 'client-ssl-profile',
-                     'certFile': self.ssl_file('client-certificate.pem'),
-                     'privateKeyFile': self.ssl_file('client-private-key.pem'),
-                     'password': 'client-password',
-                     'caCertFile': self.ssl_file('ca-certificate.pem')})
+                           'name': 'client-ssl-profile',
+                           'certFile': self.ssl_file('client-certificate.pem'),
+                           'privateKeyFile': self.ssl_file('client-private-key.pem'),
+                           'password': 'client-password',
+                           'caCertFile': self.ssl_file('ca-certificate.pem')})
         # re-create connector
         local_node.create({'type': 'connector',
-                     'name': 'connectorToX',
-                     'host': '127.0.0.1',
-                     'port': self.x_listener_port,
-                     'saslMechanisms': 'PLAIN',
-                     'sslProfile': 'client-ssl-profile',
-                     'role': 'inter-router',
-                     'verifyHostname': False,
-                     'saslUsername': 'test@domain.com',
-                     'saslPassword': 'password'})
+                           'name': 'connectorToX',
+                           'host': '127.0.0.1',
+                           'port': self.x_listener_port,
+                           'saslMechanisms': 'PLAIN',
+                           'sslProfile': 'client-ssl-profile',
+                           'role': 'inter-router',
+                           'verifyHostname': False,
+                           'saslUsername': 'test@domain.com',
+                           'saslPassword': 'password'})
         self.routers[1].wait_connectors()
         results = local_node.query(type='org.apache.qpid.dispatch.connection').get_entities()
 
@@ -760,4 +761,3 @@
 
 if __name__ == '__main__':
     unittest.main(main_module())
-
diff --git a/tests/system_tests_ssl.py b/tests/system_tests_ssl.py
index bd88592..b101882 100644
--- a/tests/system_tests_ssl.py
+++ b/tests/system_tests_ssl.py
@@ -162,7 +162,7 @@
                 OPENSSL_ALLOW_TLSV1_1 = OPENSSL_MIN_VER <= ssl.TLSVersion.TLSv1_1 <= OPENSSL_MAX_VER
                 OPENSSL_ALLOW_TLSV1_2 = OPENSSL_MIN_VER <= ssl.TLSVersion.TLSv1_2 <= OPENSSL_MAX_VER
                 OPENSSL_ALLOW_TLSV1_3 = OPENSSL_HAS_TLSV1_3 and PROTON_HAS_TLSV1_3 \
-                                    and OPENSSL_MIN_VER <= ssl.TLSVersion.TLSv1_3 <= OPENSSL_MAX_VER
+                    and OPENSSL_MIN_VER <= ssl.TLSVersion.TLSv1_3 <= OPENSSL_MAX_VER
         else:
             # At this point we are not able to precisely determine what are the minimum and maximum
             # TLS versions allowed in the system, so tests will be disabled
@@ -332,17 +332,17 @@
 
         if cls.OPENSSL_ALLOW_TLSV1_3:
             conf += [
-            # TLSv1.3 only
-            ('listener', {'host': '0.0.0.0', 'role': 'normal', 'port': cls.PORT_TLS13,
-                          'authenticatePeer': 'no',
-                          'sslProfile': 'ssl-profile-tls13'}),
-            # SSL Profile for TLSv1.3
-            ('sslProfile', {'name': 'ssl-profile-tls13',
-                            'caCertFile': cls.ssl_file('ca-certificate.pem'),
-                            'certFile': cls.ssl_file('server-certificate.pem'),
-                            'privateKeyFile': cls.ssl_file('server-private-key.pem'),
-                            'protocols': 'TLSv1.3',
-                            'password': 'server-password'})
+                # TLSv1.3 only
+                ('listener', {'host': '0.0.0.0', 'role': 'normal', 'port': cls.PORT_TLS13,
+                              'authenticatePeer': 'no',
+                              'sslProfile': 'ssl-profile-tls13'}),
+                # SSL Profile for TLSv1.3
+                ('sslProfile', {'name': 'ssl-profile-tls13',
+                                'caCertFile': cls.ssl_file('ca-certificate.pem'),
+                                'certFile': cls.ssl_file('server-certificate.pem'),
+                                'privateKeyFile': cls.ssl_file('server-private-key.pem'),
+                                'protocols': 'TLSv1.3',
+                                'password': 'server-password'})
 
             ]
 
@@ -458,7 +458,7 @@
         Expects TLSv1 only is allowed
         """
         self.assertEqual(self.get_expected_tls_result([True, False, False, False]),
-                          self.get_allowed_protocols(self.PORT_TLS1))
+                         self.get_allowed_protocols(self.PORT_TLS1))
 
     @SkipIfNeeded(RouterTestSslBase.DISABLE_SSL_TESTING, RouterTestSslBase.DISABLE_REASON)
     def test_tls11_only(self):
@@ -466,7 +466,7 @@
         Expects TLSv1.1 only is allowed
         """
         self.assertEqual(self.get_expected_tls_result([False, True, False, False]),
-                          self.get_allowed_protocols(self.PORT_TLS11))
+                         self.get_allowed_protocols(self.PORT_TLS11))
 
     @SkipIfNeeded(RouterTestSslBase.DISABLE_SSL_TESTING, RouterTestSslBase.DISABLE_REASON)
     def test_tls12_only(self):
@@ -474,7 +474,7 @@
         Expects TLSv1.2 only is allowed
         """
         self.assertEqual(self.get_expected_tls_result([False, False, True, False]),
-                          self.get_allowed_protocols(self.PORT_TLS12))
+                         self.get_allowed_protocols(self.PORT_TLS12))
 
     @SkipIfNeeded(RouterTestSslBase.DISABLE_SSL_TESTING, RouterTestSslBase.DISABLE_REASON)
     def test_tls13_only(self):
@@ -482,7 +482,7 @@
         Expects TLSv1.3 only is allowed
         """
         self.assertEqual(self.get_expected_tls_result([False, False, False, True]),
-                          self.get_allowed_protocols(self.PORT_TLS13))
+                         self.get_allowed_protocols(self.PORT_TLS13))
 
     @SkipIfNeeded(RouterTestSslBase.DISABLE_SSL_TESTING, RouterTestSslBase.DISABLE_REASON)
     def test_tls1_tls11_only(self):
@@ -490,7 +490,7 @@
         Expects TLSv1 and TLSv1.1 only are allowed
         """
         self.assertEqual(self.get_expected_tls_result([True, True, False, False]),
-                          self.get_allowed_protocols(self.PORT_TLS1_TLS11))
+                         self.get_allowed_protocols(self.PORT_TLS1_TLS11))
 
     @SkipIfNeeded(RouterTestSslBase.DISABLE_SSL_TESTING, RouterTestSslBase.DISABLE_REASON)
     def test_tls1_tls12_only(self):
@@ -498,7 +498,7 @@
         Expects TLSv1 and TLSv1.2 only are allowed
         """
         self.assertEqual(self.get_expected_tls_result([True, False, True, False]),
-                          self.get_allowed_protocols(self.PORT_TLS1_TLS12))
+                         self.get_allowed_protocols(self.PORT_TLS1_TLS12))
 
     @SkipIfNeeded(RouterTestSslBase.DISABLE_SSL_TESTING, RouterTestSslBase.DISABLE_REASON)
     def test_tls11_tls12_only(self):
@@ -506,7 +506,7 @@
         Expects TLSv1.1 and TLSv1.2 only are allowed
         """
         self.assertEqual(self.get_expected_tls_result([False, True, True, False]),
-                          self.get_allowed_protocols(self.PORT_TLS11_TLS12))
+                         self.get_allowed_protocols(self.PORT_TLS11_TLS12))
 
     @SkipIfNeeded(RouterTestSslBase.DISABLE_SSL_TESTING, RouterTestSslBase.DISABLE_REASON)
     def test_tls_all(self):
@@ -514,7 +514,7 @@
         Expects all supported versions: TLSv1, TLSv1.1, TLSv1.2 and TLSv1.3 to be allowed
         """
         self.assertEqual(self.get_expected_tls_result([True, True, True, True]),
-                          self.get_allowed_protocols(self.PORT_TLS_ALL))
+                         self.get_allowed_protocols(self.PORT_TLS_ALL))
 
     @SkipIfNeeded(RouterTestSslBase.DISABLE_SSL_TESTING, RouterTestSslBase.DISABLE_REASON)
     def test_ssl_invalid(self):
@@ -915,19 +915,19 @@
         pattern = " SERVER (error) SSL CA configuration failed"
         host_port_1 = self.CONNECTOR_HOST + ":" + str(self.PORT_TLS_ALL_1)
         host_port_2 = self.CONNECTOR_HOST + ":" + str(self.PORT_TLS_ALL_2)
-        sleep_time = 0.1 # seconds
-        poll_duration = 60.0 # seconds
+        sleep_time = 0.1  # seconds
+        poll_duration = 60.0  # seconds
         verified = False
         for tries in range(int(poll_duration / sleep_time)):
             logfile = os.path.join(self.routers[1].outdir, self.routers[1].logfile)
             if os.path.exists(logfile):
-                with  open(logfile, 'r') as router_log:
+                with open(logfile, 'r') as router_log:
                     log_lines = router_log.read().split("\n")
                 e1_lines = [s for s in log_lines if pattern in s and host_port_1 in s]
                 e2_lines = [s for s in log_lines if pattern in s and host_port_2 in s]
                 verified = len(e1_lines) > 0 and len(e2_lines) > 0
                 if verified:
-                    break;
+                    break
             time.sleep(sleep_time)
         self.assertTrue(verified, "Log line containing '%s' not seen for both connectors in QDR.B log" % pattern)
 
@@ -937,13 +937,13 @@
         for tries in range(int(poll_duration / sleep_time)):
             logfile = os.path.join(self.routers[1].outdir, self.routers[1].logfile)
             if os.path.exists(logfile):
-                with  open(logfile, 'r') as router_log:
+                with open(logfile, 'r') as router_log:
                     log_lines = router_log.read().split("\n")
                 e1_lines = [s for s in log_lines if pattern1 in s]
                 e2_lines = [s for s in log_lines if pattern2 in s]
                 verified = len(e1_lines) > 0 and len(e2_lines) > 0
                 if verified:
-                    break;
+                    break
             time.sleep(sleep_time)
         self.assertTrue(verified, "Log line containing '%s' or '%s' not seen in QDR.B log" % (pattern1, pattern2))
 
@@ -1067,18 +1067,18 @@
 
         # Poll for a while until the connector error shows up in router B's log
         pattern = "Connection to localhost:%s failed:" % self.PORT_TLS_ALL
-        sleep_time = 0.1 # seconds
-        poll_duration = 60.0 # seconds
+        sleep_time = 0.1  # seconds
+        poll_duration = 60.0  # seconds
         verified = False
         for tries in range(int(poll_duration / sleep_time)):
             logfile = os.path.join(self.routers[1].outdir, self.routers[1].logfile)
             if os.path.exists(logfile):
-                with  open(logfile, 'r') as router_log:
+                with open(logfile, 'r') as router_log:
                     log_lines = router_log.read().split("\n")
                 e_lines = [s for s in log_lines if pattern in s]
                 verified = len(e_lines) > 0
                 if verified:
-                    break;
+                    break
             time.sleep(sleep_time)
         self.assertTrue(verified, "Log line containing '%s' not seen in QDR.B log" % pattern)
 
@@ -1089,6 +1089,5 @@
         self.assertNotIn(node, router_nodes, msg=("%s should not be connected" % node))
 
 
-
 if __name__ == '__main__':
     unittest.main(main_module())
diff --git a/tests/system_tests_stuck_deliveries.py b/tests/system_tests_stuck_deliveries.py
index 9cc13ce..e4d9ce6 100644
--- a/tests/system_tests_stuck_deliveries.py
+++ b/tests/system_tests_stuck_deliveries.py
@@ -88,7 +88,6 @@
         cls.routers[0].wait_router_connected('INT.B')
         cls.routers[1].wait_router_connected('INT.A')
 
-
     def test_01_delayed_settlement_same_interior(self):
         test = DelayedSettlementTest(self.routers[0].addresses[0],
                                      self.routers[0].addresses[0],
@@ -101,7 +100,7 @@
         test = DelayedSettlementTest(self.routers[2].addresses[0],
                                      self.routers[5].addresses[0],
                                      self.routers[2].addresses[0],
-                                     'dest.02', 10, [2,3,8], False)
+                                     'dest.02', 10, [2, 3, 8], False)
         test.run()
         self.assertEqual(None, test.error)
 
@@ -109,7 +108,7 @@
         test = DelayedSettlementTest(self.routers[2].addresses[0],
                                      self.routers[5].addresses[0],
                                      self.routers[5].addresses[0],
-                                     'dest.03', 10, [2,4,9], False)
+                                     'dest.03', 10, [2, 4, 9], False)
         test.run()
         self.assertEqual(None, test.error)
 
@@ -117,7 +116,7 @@
         test = DelayedSettlementTest(self.routers[2].addresses[0],
                                      self.routers[5].addresses[0],
                                      self.routers[0].addresses[0],
-                                     'dest.04', 10, [0,2,3,8], False)
+                                     'dest.04', 10, [0, 2, 3, 8], False)
         test.run()
         self.assertEqual(None, test.error)
 
@@ -125,7 +124,7 @@
         test = DelayedSettlementTest(self.routers[0].addresses[0],
                                      self.routers[0].addresses[0],
                                      self.routers[0].addresses[0],
-                                     'dest.05', 10, [0,2,4,9], True)
+                                     'dest.05', 10, [0, 2, 4, 9], True)
         test.run()
         self.assertEqual(None, test.error)
 
@@ -141,7 +140,7 @@
         test = DelayedSettlementTest(self.routers[2].addresses[0],
                                      self.routers[5].addresses[0],
                                      self.routers[5].addresses[0],
-                                     'dest.07', 10, [0,9], True)
+                                     'dest.07', 10, [0, 9], True)
         test.run()
         self.assertEqual(None, test.error)
 
@@ -149,7 +148,7 @@
         test = DelayedSettlementTest(self.routers[2].addresses[0],
                                      self.routers[5].addresses[0],
                                      self.routers[0].addresses[0],
-                                     'dest.08', 10, [1,2,3,4,5,6,7,8], True)
+                                     'dest.08', 10, [1, 2, 3, 4, 5, 6, 7, 8], True)
         test.run()
         self.assertEqual(None, test.error)
 
@@ -166,7 +165,7 @@
 
 class DelayedSettlementTest(MessagingHandler):
     def __init__(self, sender_host, receiver_host, query_host, addr, dlv_count, stuck_list, close_link):
-        super(DelayedSettlementTest, self).__init__(auto_accept = False)
+        super(DelayedSettlementTest, self).__init__(auto_accept=False)
         self.sender_host   = sender_host
         self.receiver_host = receiver_host
         self.query_host    = query_host
@@ -276,7 +275,7 @@
 
 class RxLinkCreditTest(MessagingHandler):
     def __init__(self, host):
-        super(RxLinkCreditTest, self).__init__(prefetch = 0)
+        super(RxLinkCreditTest, self).__init__(prefetch=0)
         self.host = host
 
         self.receiver_conn = None
@@ -342,14 +341,14 @@
             # 10Credits
             #
             msg = self.proxy.query_links()
-            self.query_sender.send(msg)            
+            self.query_sender.send(msg)
 
         elif self.stage == 4:
             #
             # 20Credits
             #
             msg = self.proxy.query_links()
-            self.query_sender.send(msg)            
+            self.query_sender.send(msg)
 
     def on_message(self, event):
         if event.receiver == self.reply_receiver:
@@ -395,7 +394,7 @@
                         if link.creditAvailable == 20:
                             self.fail(None)
                             return
-            
+
             self.poll_timer = event.reactor.schedule(0.5, PollTimeout(self))
 
     def poll_timeout(self):
@@ -473,7 +472,7 @@
             # 250Credits
             #
             msg = self.proxy.query_links()
-            self.query_sender.send(msg)            
+            self.query_sender.send(msg)
 
     def on_message(self, event):
         if event.receiver == self.reply_receiver:
@@ -483,7 +482,7 @@
                 # LinkBlocked
                 #
                 if response.results[0].linksBlocked == 1:
-                    self.receiver = event.container.create_receiver(self.sender_conn, self.addr);
+                    self.receiver = event.container.create_receiver(self.sender_conn, self.addr)
                     self.stage = 2
                     self.process()
                     return
@@ -516,5 +515,5 @@
         Container(self).run()
 
 
-if __name__== '__main__':
+if __name__ == '__main__':
     unittest.main(main_module())
diff --git a/tests/system_tests_tcp_adaptor.py b/tests/system_tests_tcp_adaptor.py
index 301b1bc..09a50ec 100644
--- a/tests/system_tests_tcp_adaptor.py
+++ b/tests/system_tests_tcp_adaptor.py
@@ -52,6 +52,7 @@
 except ImportError:
     class TCP_echo_client(object):
         pass
+
     class TCP_echo_server(object):
         pass
 
@@ -64,12 +65,14 @@
     DISABLE_SELECTOR_TESTS = True
     DISABLE_SELECTOR_REASON = "Python selectors module is not available on this platform."
 
+
 class Logger():
     """
     Record event logs as existing Logger. Also add:
     * ofile  - optional file opened in 'append' mode to which each log line is written
     TODO: Replace system_test Logger with this after merging dev-protocol-adaptors branch
     """
+
     def __init__(self,
                  title="Logger",
                  print_to_console=False,
@@ -84,7 +87,7 @@
     def log(self, msg):
         ts = Timestamp()
         if self.save_for_dump:
-            self.logs.append( (ts, msg) )
+            self.logs.append((ts, msg))
         if self.print_to_console:
             print("%s %s" % (ts, msg))
             sys.stdout.flush()
@@ -215,7 +218,7 @@
                             'address': 'ES_' + rtr,
                             'siteId': cls.site}
                 tup = [(('tcpListener', listener))]
-                listeners.extend( tup )
+                listeners.extend(tup)
             config.extend(listeners)
 
             if extra:
@@ -263,7 +266,7 @@
                              (rtr, tcp_listener, cls.tcp_client_listener_ports[rtr][tcp_listener]))
             p_out.append("%s_nodest_listener=%d" %
                          (rtr, cls.nodest_listener_ports[rtr]))
-            #p_out.append("%s_http_listener=%d" %
+            # p_out.append("%s_http_listener=%d" %
             #             (rtr, cls.http_listener_ports[rtr]))
         p_out.append("inter_router_port_AB=%d" % inter_router_port_AB)
         p_out.append("inter_router_port_BC=%d" % inter_router_port_BC)
@@ -410,7 +413,7 @@
         # stop echo servers
         for rtr in cls.router_order:
             server = cls.echo_servers.get(rtr)
-            if not server is None:
+            if server is not None:
                 cls.logger.log("TCP_TEST Stopping echo server %s" % rtr)
                 server.wait()
         super(TcpAdaptor, cls).tearDownClass()
@@ -424,6 +427,7 @@
         Provide poll interface for checking done/error.
         Provide wait/join to shut down.
         """
+
         def __init__(self, test_name, client_n, logger, client, server, size, count, print_client_logs):
             """
             Launch an echo client upon construction.
@@ -501,6 +505,7 @@
         For the concurrent tcp tests this class describes one of the client-
         server echo pairs and the traffic pattern between them.
         """
+
         def __init__(self, client_rtr, server_rtr, sizes=None, counts=None):
             self.client_rtr = client_rtr
             self.server_rtr = server_rtr
@@ -547,7 +552,7 @@
                     break
                 # Make sure servers are still up
                 for rtr in TcpAdaptor.router_order:
-                    es =TcpAdaptor.echo_servers[rtr]
+                    es = TcpAdaptor.echo_servers[rtr]
                     if es.error is not None:
                         self.logger.log("TCP_TEST %s Server %s stopped with error: %s" %
                                         (test_name, es.prefix, es.error))
@@ -600,7 +605,7 @@
 
         except Exception as exc:
             result = "TCP_TEST %s failed. Exception: %s" % \
-                              (test_name, traceback.format_exc())
+                (test_name, traceback.format_exc())
 
         return result
 
@@ -703,5 +708,5 @@
         self.logger.log("TCP_TEST Stop %s SUCCESS" % name)
 
 
-if __name__== '__main__':
+if __name__ == '__main__':
     unittest.main(main_module())
diff --git a/tests/system_tests_topology.py b/tests/system_tests_topology.py
index be2cefd..be84e10 100644
--- a/tests/system_tests_topology.py
+++ b/tests/system_tests_topology.py
@@ -22,80 +22,77 @@
 from __future__ import absolute_import
 from __future__ import print_function
 
-from proton          import Message, Timeout
+from proton import Message, Timeout
 from system_test import AsyncTestReceiver
-from system_test     import TestCase, Qdrouterd, main_module
+from system_test import TestCase, Qdrouterd, main_module
 from system_test import TIMEOUT
 from system_test import unittest
 from proton.handlers import MessagingHandler
-from proton.reactor  import Container
+from proton.reactor import Container
 
 import time
 
-#------------------------------------------------
+# ------------------------------------------------
 # Helper classes for all tests.
-#------------------------------------------------
+# ------------------------------------------------
+
 
 class Timeout(object):
     """
     Named timeout object can handle multiple simultaneous
     timers, by telling the parent which one fired.
     """
-    def __init__ ( self, parent, name ):
+
+    def __init__(self, parent, name):
         self.parent = parent
         self.name   = name
 
-    def on_timer_task ( self, event ):
-        self.parent.timeout ( self.name )
+    def on_timer_task(self, event):
+        self.parent.timeout(self.name)
 
 
-
-class ManagementMessageHelper ( object ):
+class ManagementMessageHelper (object):
     """
     Format management messages.
     """
-    def __init__ ( self, reply_addr ):
+
+    def __init__(self, reply_addr):
         self.reply_addr = reply_addr
 
-    def make_connector_query ( self, connector_name ):
-        props = {'operation': 'READ', 'type': 'org.apache.qpid.dispatch.connector', 'name' : connector_name }
-        msg = Message ( properties=props, reply_to=self.reply_addr )
+    def make_connector_query(self, connector_name):
+        props = {'operation': 'READ', 'type': 'org.apache.qpid.dispatch.connector', 'name' : connector_name}
+        msg = Message(properties=props, reply_to=self.reply_addr)
         return msg
 
-    def make_connector_delete_command ( self, connector_name ):
-        props = {'operation': 'DELETE', 'type': 'org.apache.qpid.dispatch.connector', 'name' : connector_name }
-        msg = Message ( properties=props, reply_to=self.reply_addr )
+    def make_connector_delete_command(self, connector_name):
+        props = {'operation': 'DELETE', 'type': 'org.apache.qpid.dispatch.connector', 'name' : connector_name}
+        msg = Message(properties=props, reply_to=self.reply_addr)
         return msg
 
 
-#------------------------------------------------
+# ------------------------------------------------
 # END Helper classes for all tests.
-#------------------------------------------------
+# ------------------------------------------------
 
 
-
-
-
-#================================================================
+# ================================================================
 #     Setup
-#================================================================
+# ================================================================
 
-class TopologyTests ( TestCase ):
+class TopologyTests (TestCase):
 
     @classmethod
     def setUpClass(cls):
         super(TopologyTests, cls).setUpClass()
 
-
-
         def router(name, more_config):
 
-            config = [ ('router',  {'mode': 'interior', 'id': name}),
-                       ('address', {'prefix': 'closest',   'distribution': 'closest'}),
-                       ('address', {'prefix': 'balanced',  'distribution': 'balanced'}),
-                       ('address', {'prefix': 'multicast', 'distribution': 'multicast'})
-                     ]    \
-                     + more_config
+            config = [('router',  {'mode': 'interior', 'id': name}),
+                      ('address', {'prefix': 'closest',   'distribution': 'closest'}),
+                      ('address', {'prefix': 'balanced',  'distribution': 'balanced'}),
+                      ('address', {'prefix': 'multicast', 'distribution': 'multicast'})
+                      ]    \
+                + more_config
 
             config = Qdrouterd.Config(config)
 
@@ -146,120 +143,116 @@
         cls.B_D_cost =   20
         cls.C_D_cost =    1
 
-        router ( 'A',
-                 [
-                    ( 'listener',
-                      { 'port': A_client_port,
-                        'role': 'normal',
-                        'stripAnnotations': 'no'
-                      }
+        router('A',
+               [
+                   ('listener',
+                    {'port': A_client_port,
+                     'role': 'normal',
+                     'stripAnnotations': 'no'
+                     }
                     ),
-                    ( 'listener',
-                      { 'role': 'inter-router',
-                        'port': A_inter_router_port,
-                        'stripAnnotations': 'no'
-                      }
+                   ('listener',
+                    {'role': 'inter-router',
+                     'port': A_inter_router_port,
+                     'stripAnnotations': 'no'
+                     }
                     )
-                 ]
+               ]
                )
 
-
-        router ( 'B',
-                 [
-                    ( 'listener',
-                      { 'port': B_client_port,
-                        'role': 'normal',
-                        'stripAnnotations': 'no'
-                      }
+        router('B',
+               [
+                   ('listener',
+                    {'port': B_client_port,
+                     'role': 'normal',
+                     'stripAnnotations': 'no'
+                     }
                     ),
-                    ( 'listener',
-                      { 'role': 'inter-router',
-                        'port': B_inter_router_port,
-                        'stripAnnotations': 'no'
-                      }
+                   ('listener',
+                    {'role': 'inter-router',
+                     'port': B_inter_router_port,
+                     'stripAnnotations': 'no'
+                     }
                     ),
-                    ( 'connector',
-                      {  'name': 'AB_connector',
-                         'role': 'inter-router',
-                         'port': A_inter_router_port,
-                         'cost':  cls.A_B_cost,
-                         'stripAnnotations': 'no'
-                      }
+                   ('connector',
+                    {'name': 'AB_connector',
+                     'role': 'inter-router',
+                     'port': A_inter_router_port,
+                     'cost': cls.A_B_cost,
+                     'stripAnnotations': 'no'
+                     }
                     )
-                 ]
+               ]
                )
 
-
-        router ( 'C',
-                 [
-                    ( 'listener',
-                      { 'port': C_client_port,
-                        'role': 'normal',
-                        'stripAnnotations': 'no'
-                      }
+        router('C',
+               [
+                   ('listener',
+                    {'port': C_client_port,
+                     'role': 'normal',
+                     'stripAnnotations': 'no'
+                     }
                     ),
-                    ( 'listener',
-                      { 'role': 'inter-router',
-                        'port': C_inter_router_port,
-                        'stripAnnotations': 'no'
-                      }
+                   ('listener',
+                    {'role': 'inter-router',
+                     'port': C_inter_router_port,
+                     'stripAnnotations': 'no'
+                     }
                     ),
-                    ( 'connector',
-                      {  'name': 'AC_connector',
-                         'role': 'inter-router',
-                         'port': A_inter_router_port,
-                         'cost' : cls.A_C_cost,
-                         'stripAnnotations': 'no'
-                      }
+                   ('connector',
+                    {'name': 'AC_connector',
+                     'role': 'inter-router',
+                     'port': A_inter_router_port,
+                     'cost' : cls.A_C_cost,
+                     'stripAnnotations': 'no'
+                     }
                     ),
-                    ( 'connector',
-                      {  'name': 'BC_connector',
-                         'role': 'inter-router',
-                         'port': B_inter_router_port,
-                         'cost' : cls.B_C_cost,
-                         'stripAnnotations': 'no'
-                      }
+                   ('connector',
+                    {'name': 'BC_connector',
+                     'role': 'inter-router',
+                     'port': B_inter_router_port,
+                     'cost' : cls.B_C_cost,
+                     'stripAnnotations': 'no'
+                     }
                     )
-                 ]
+               ]
                )
 
-
-        router ( 'D',
-                 [
-                    ( 'listener',
-                      { 'port': D_client_port,
-                        'role': 'normal',
-                        'stripAnnotations': 'no'
-                      }
+        router('D',
+               [
+                   ('listener',
+                    {'port': D_client_port,
+                     'role': 'normal',
+                     'stripAnnotations': 'no'
+                     }
                     ),
-                    ( 'connector',
-                      {  'name': 'AD_connector',
-                         'role': 'inter-router',
-                         'port': A_inter_router_port,
-                         'cost' : cls.A_D_cost,
-                         'stripAnnotations': 'no'
-                      }
+                   ('connector',
+                    {'name': 'AD_connector',
+                     'role': 'inter-router',
+                     'port': A_inter_router_port,
+                     'cost' : cls.A_D_cost,
+                     'stripAnnotations': 'no'
+                     }
                     ),
-                    ( 'connector',
-                      {  'name': 'BD_connector',
-                         'role': 'inter-router',
-                         'port': B_inter_router_port,
-                         'cost' : cls.B_D_cost,
-                         'stripAnnotations': 'no'
-                      }
+                   ('connector',
+                    {'name': 'BD_connector',
+                     'role': 'inter-router',
+                     'port': B_inter_router_port,
+                     'cost' : cls.B_D_cost,
+                     'stripAnnotations': 'no'
+                     }
                     ),
-                    ( 'connector',
-                      {  'name': 'CD_connector',
-                         'role': 'inter-router',
-                         'port': C_inter_router_port,
-                         'cost' : cls.C_D_cost,
-                         'stripAnnotations': 'no'
-                      }
+                   ('connector',
+                    {'name': 'CD_connector',
+                     'role': 'inter-router',
+                     'port': C_inter_router_port,
+                     'cost' : cls.C_D_cost,
+                     'stripAnnotations': 'no'
+                     }
                     )
-                 ]
+               ]
                )
 
-
         router_A = cls.routers[0]
         router_B = cls.routers[1]
         router_C = cls.routers[2]
@@ -269,39 +262,36 @@
         router_A.wait_router_connected('C')
         router_A.wait_router_connected('D')
 
-        cls.client_addrs = ( router_A.addresses[0],
-                             router_B.addresses[0],
-                             router_C.addresses[0],
-                             router_D.addresses[0]
-                           )
+        cls.client_addrs = (router_A.addresses[0],
+                            router_B.addresses[0],
+                            router_C.addresses[0],
+                            router_D.addresses[0]
+                            )
 
         # 1 means skip that test.
-        cls.skip = { 'test_01' : 0
-                   }
+        cls.skip = {'test_01' : 0
+                    }
 
-
-
-    def test_01_topology_failover ( self ):
+    def test_01_topology_failover(self):
         name = 'test_01'
-        if self.skip [ name ] :
-            self.skipTest ( "Test skipped during development." )
-        test = TopologyFailover ( name,
-                                  self.client_addrs,
-                                  "closest/01"
+        if self.skip[name] :
+            self.skipTest("Test skipped during development.")
+        test = TopologyFailover(name,
+                                self.client_addrs,
+                                "closest/01"
                                 )
         test.run()
-        self.assertEqual ( None, test.error )
+        self.assertEqual(None, test.error)
 
 
-
-#================================================================
+# ================================================================
 #     Tests
-#================================================================
+# ================================================================
 
 
 # Also see 'Test 1 TopologyFailover Notes', above.
 
-class TopologyFailover ( MessagingHandler ):
+class TopologyFailover (MessagingHandler):
     """
     Test that the lowest-cost route is always chosen in a 4-mesh
     network topology, as one link after another is lost.
@@ -309,7 +299,8 @@
     This test also ensures that connections that have been
     deliberately severed do no get restored.
     """
-    def __init__ ( self, test_name, client_addrs, destination ):
+
+    def __init__(self, test_name, client_addrs, destination):
         super(TopologyFailover, self).__init__(prefetch=0)
         self.client_addrs     = client_addrs
         self.dest       = destination
@@ -332,40 +323,39 @@
         # Holds the management sender, receiver, and 'helper'
         # associated with each router.
         self.routers = {
-                         'A' : dict(),
-                         'B' : dict(),
-                         'C' : dict(),
-                         'D' : dict()
-                       }
+            'A' : dict(),
+            'B' : dict(),
+            'C' : dict(),
+            'D' : dict()
+        }
 
         # These are the expectes routing traces, in the order we
         # expect to receive them.
         self.expected_traces = [
-                                 [u'0/A', u'0/D', u'0/C', u'0/B'],
-                                 [u'0/A', u'0/D', u'0/B'],
-                                 [u'0/A', u'0/C', u'0/B'],
-                                 [u'0/A', u'0/B']
-                               ]
+            [u'0/A', u'0/D', u'0/C', u'0/B'],
+            [u'0/A', u'0/D', u'0/B'],
+            [u'0/A', u'0/C', u'0/B'],
+            [u'0/A', u'0/B']
+        ]
         self.trace_count    = 0
 
         # This tells the system in what order to kill the connectors.
         self.kill_list = (
-                           ( 'D', 'CD_connector' ),
-                           ( 'D', 'BD_connector' ),
-                           ( 'C', 'BC_connector' )
-                         )
+            ('D', 'CD_connector'),
+            ('D', 'BD_connector'),
+            ('C', 'BC_connector')
+        )
 
         # Use this to keep track of which connectors we have found
         # when the test is first getting started and we are checking
         # the topology.
-        self.connectors_map = { 'AB_connector' : 0,
-                                'AC_connector' : 0,
-                                'AD_connector' : 0,
-                                'BC_connector' : 0,
-                                'BD_connector' : 0,
-                                'CD_connector' : 0
-                              }
-
+        self.connectors_map = {'AB_connector' : 0,
+                               'AC_connector' : 0,
+                               'AD_connector' : 0,
+                               'BC_connector' : 0,
+                               'BD_connector' : 0,
+                               'CD_connector' : 0
+                               }
 
     # The simple state machine transitions when certain events happen,
     # if certain conditions are met.  The conditions are checked for
@@ -382,35 +372,31 @@
     #  5. examine_trace   -- checks routing trace of final message
     #  5. bailing         -- bails out with success
 
-
-    def state_transition ( self, message, new_state ) :
+    def state_transition(self, message, new_state) :
         if self.state == new_state :
             return
         self.state = new_state
-        self.debug_print ( "state transition to : %s -- because %s" % ( self.state, message ) )
+        self.debug_print("state transition to : %s -- because %s" % (self.state, message))
 
-
-    def debug_print ( self, text ) :
-        if self.debug == True:
+    def debug_print(self, text) :
+        if self.debug:
             print("%s %s" % (time.time(), text))
 
-
     # Shut down everything and exit.
-    def bail ( self, text ):
+    def bail(self, text):
         self.error = text
 
-        self.send_conn.close ( )
-        self.recv_conn.close ( )
+        self.send_conn.close()
+        self.recv_conn.close()
 
-        self.routers['B'] ['mgmt_conn'].close()
-        self.routers['C'] ['mgmt_conn'].close()
-        self.routers['D'] ['mgmt_conn'].close()
+        self.routers['B']['mgmt_conn'].close()
+        self.routers['C']['mgmt_conn'].close()
+        self.routers['D']['mgmt_conn'].close()
 
-        self.test_timer.cancel ( )
-        self.send_timer.cancel ( )
+        self.test_timer.cancel()
+        self.send_timer.cancel()
 
-
-    #------------------------------------------------------------------------
+    # ------------------------------------------------------------------------
     # I want some behavior from this test that is a little too complex
     # to be governed by the usual callback functions. The way I do this
     # is by making a simple state machine that checks some conditions
@@ -420,169 +406,159 @@
     # or timeout.  But there are two different timers: the one-second
     # timer that mostly runs the test, and the 60-second timer that, if it
     # fires, will terminate the test with a timeout error.
-    #------------------------------------------------------------------------
-    def timeout ( self, name ):
+    # ------------------------------------------------------------------------
+    def timeout(self, name):
         if name == 'test':
-            self.set_state ( 'Timeout Expired', 'bailing' )
-            self.bail ( "Timeout Expired: n_sent=%d n_received=%d n_accepted=%d" % \
-                         ( self.n_sent, self.n_received, self.n_accepted ) )
+            self.set_state('Timeout Expired', 'bailing')
+            self.bail("Timeout Expired: n_sent=%d n_received=%d n_accepted=%d" %
+                      (self.n_sent, self.n_received, self.n_accepted))
         elif name == 'sender':
             if self.state == 'examine_trace' :
-                self.send ( )
+                self.send()
             self.send_timer = self.reactor.schedule(1, Timeout(self, "sender"))
 
-
-    def on_start ( self, event ):
-        self.state_transition ( 'on_start', 'starting' )
+    def on_start(self, event):
+        self.state_transition('on_start', 'starting')
         self.reactor = event.reactor
-        self.test_timer = event.reactor.schedule ( TIMEOUT, Timeout(self, "test") )
-        self.send_timer = event.reactor.schedule ( 1, Timeout(self, "sender") )
-        self.send_conn  = event.container.connect ( self.client_addrs[0] ) # A
-        self.recv_conn  = event.container.connect ( self.client_addrs[1] ) # B
+        self.test_timer = event.reactor.schedule(TIMEOUT, Timeout(self, "test"))
+        self.send_timer = event.reactor.schedule(1, Timeout(self, "sender"))
+        self.send_conn  = event.container.connect(self.client_addrs[0])  # A
+        self.recv_conn  = event.container.connect(self.client_addrs[1])  # B
 
-        self.sender     = event.container.create_sender   ( self.send_conn, self.dest )
-        self.receiver   = event.container.create_receiver ( self.recv_conn, self.dest )
-        self.receiver.flow ( 100 )
+        self.sender     = event.container.create_sender(self.send_conn, self.dest)
+        self.receiver   = event.container.create_receiver(self.recv_conn, self.dest)
+        self.receiver.flow(100)
 
         # I will only send management messages to B, C, and D, because
         # they are the owners of the connections that I will want to delete.
-        self.routers['B'] ['mgmt_conn'] = event.container.connect ( self.client_addrs[1] )
-        self.routers['C'] ['mgmt_conn'] = event.container.connect ( self.client_addrs[2] )
-        self.routers['D'] ['mgmt_conn'] = event.container.connect ( self.client_addrs[3] )
+        self.routers['B']['mgmt_conn'] = event.container.connect(self.client_addrs[1])
+        self.routers['C']['mgmt_conn'] = event.container.connect(self.client_addrs[2])
+        self.routers['D']['mgmt_conn'] = event.container.connect(self.client_addrs[3])
 
-        self.routers['B'] ['mgmt_receiver'] = event.container.create_receiver ( self.routers['B'] ['mgmt_conn'], dynamic=True )
-        self.routers['C'] ['mgmt_receiver'] = event.container.create_receiver ( self.routers['C'] ['mgmt_conn'], dynamic=True )
-        self.routers['D'] ['mgmt_receiver'] = event.container.create_receiver ( self.routers['D'] ['mgmt_conn'], dynamic=True )
+        self.routers['B']['mgmt_receiver'] = event.container.create_receiver(self.routers['B']['mgmt_conn'], dynamic=True)
+        self.routers['C']['mgmt_receiver'] = event.container.create_receiver(self.routers['C']['mgmt_conn'], dynamic=True)
+        self.routers['D']['mgmt_receiver'] = event.container.create_receiver(self.routers['D']['mgmt_conn'], dynamic=True)
 
-        self.routers['B'] ['mgmt_sender']   = event.container.create_sender   ( self.routers['B'] ['mgmt_conn'], "$management" )
-        self.routers['C'] ['mgmt_sender']   = event.container.create_sender   ( self.routers['C'] ['mgmt_conn'], "$management" )
-        self.routers['D'] ['mgmt_sender']   = event.container.create_sender   ( self.routers['D'] ['mgmt_conn'], "$management" )
+        self.routers['B']['mgmt_sender']   = event.container.create_sender(self.routers['B']['mgmt_conn'], "$management")
+        self.routers['C']['mgmt_sender']   = event.container.create_sender(self.routers['C']['mgmt_conn'], "$management")
+        self.routers['D']['mgmt_sender']   = event.container.create_sender(self.routers['D']['mgmt_conn'], "$management")
 
-
-
-    #-----------------------------------------------------------------
+    # -----------------------------------------------------------------
     # At start-time, as the links to the three managed routers
     # open, check each one to make sure that it has all the expected
     # connections.
-    #-----------------------------------------------------------------
-    def on_link_opened ( self, event ) :
-        self.state_transition ( 'on_link_opened', 'checking' )
+    # -----------------------------------------------------------------
+
+    def on_link_opened(self, event) :
+        self.state_transition('on_link_opened', 'checking')
         # The B mgmt link has opened. Check its connections. --------------------------
-        if event.receiver == self.routers['B'] ['mgmt_receiver'] :
-            event.receiver.flow ( 1000 )
-            self.routers['B'] ['mgmt_helper'] = ManagementMessageHelper ( event.receiver.remote_source.address )
-            for connector in [ 'AB_connector' ] :
-                self.connector_check ( 'B', connector )
+        if event.receiver == self.routers['B']['mgmt_receiver'] :
+            event.receiver.flow(1000)
+            self.routers['B']['mgmt_helper'] = ManagementMessageHelper(event.receiver.remote_source.address)
+            for connector in ['AB_connector'] :
+                self.connector_check('B', connector)
         # The C mgmt link has opened. Check its connections. --------------------------
-        elif event.receiver == self.routers['C'] ['mgmt_receiver'] :
-            event.receiver.flow ( 1000 )
-            self.routers['C'] ['mgmt_helper'] = ManagementMessageHelper ( event.receiver.remote_source.address )
-            for connector in [ 'AC_connector', 'BC_connector' ] :
-                self.connector_check ( 'C', connector )
+        elif event.receiver == self.routers['C']['mgmt_receiver'] :
+            event.receiver.flow(1000)
+            self.routers['C']['mgmt_helper'] = ManagementMessageHelper(event.receiver.remote_source.address)
+            for connector in ['AC_connector', 'BC_connector'] :
+                self.connector_check('C', connector)
         # The D mgmt link has opened. Check its connections. --------------------------
-        elif event.receiver == self.routers['D'] ['mgmt_receiver']:
-            event.receiver.flow ( 1000 )
-            self.routers['D'] ['mgmt_helper'] = ManagementMessageHelper ( event.receiver.remote_source.address )
-            for connector in [ 'AD_connector', 'BD_connector', 'CD_connector' ] :
-                self.connector_check ( 'D', connector )
+        elif event.receiver == self.routers['D']['mgmt_receiver']:
+            event.receiver.flow(1000)
+            self.routers['D']['mgmt_helper'] = ManagementMessageHelper(event.receiver.remote_source.address)
+            for connector in ['AD_connector', 'BD_connector', 'CD_connector'] :
+                self.connector_check('D', connector)
 
-
-    def send ( self ):
+    def send(self):
         n_sent_this_time = 0
         if self.sender.credit <= 0:
-          self.receiver.flow ( 100 )
-          return
+            self.receiver.flow(100)
+            return
         # Send messages one at a time.
         if self.sender.credit > 0 :
-            msg = Message ( body=self.n_sent )
-            self.sender.send ( msg )
+            msg = Message(body=self.n_sent)
+            self.sender.send(msg)
             n_sent_this_time += 1
             self.n_sent += 1
-        self.debug_print ( "sent: %d" % self.n_sent )
+        self.debug_print("sent: %d" % self.n_sent)
 
+    def on_message(self, event):
 
-    def on_message ( self, event ):
+        if event.receiver == self.routers['B']['mgmt_receiver'] or \
+           event.receiver == self.routers['C']['mgmt_receiver'] or \
+           event.receiver == self.routers['D']['mgmt_receiver'] :
 
-        if event.receiver == self.routers['B'] ['mgmt_receiver'] or \
-           event.receiver == self.routers['C'] ['mgmt_receiver'] or \
-           event.receiver == self.routers['D'] ['mgmt_receiver'] :
-
-            #----------------------------------------------------------------
+            # ----------------------------------------------------------------
             # This is a management message.
-            #----------------------------------------------------------------
+            # ----------------------------------------------------------------
             if self.state == 'checking' :
                 connection_name = event.message.body['name']
 
                 if connection_name in self.connectors_map :
-                    self.connectors_map [ connection_name ] = 1
+                    self.connectors_map[connection_name] = 1
                 else :
-                  self.state_transition ( "bad connection name: %s" % connection_name, 'bailing' )
-                  self.bail ( "bad connection name: %s" % connection_name )
+                    self.state_transition("bad connection name: %s" % connection_name, 'bailing')
+                    self.bail("bad connection name: %s" % connection_name)
 
                 n_connections = sum(self.connectors_map.values())
                 if n_connections == 6 :
-                  self.state_transition ( "all %d connections found" % n_connections, 'examine_trace' )
+                    self.state_transition("all %d connections found" % n_connections, 'examine_trace')
             elif self.state == 'kill_connector' :
                 if event.message.properties["statusDescription"] == 'No Content':
                     # We are in the process of killing a connector, and
                     # have received the response to the kill message.
-                    self.state_transition ( 'got kill response', 'examine_trace' )
+                    self.state_transition('got kill response', 'examine_trace')
                     # This sleep is here because one early bug that this test found
-                    # (and which is now fixed) involved connections that had been 
-                    # deleted coming back sometimes. It was a race and only happened 
-                    # very occasionally -- but with a pause here, after getting 
-                    # confirmation that we have successfully deleted the connector, 
+                    # (and which is now fixed) involved connections that had been
+                    # deleted coming back sometimes. It was a race and only happened
+                    # very occasionally -- but with a pause here, after getting
+                    # confirmation that we have successfully deleted the connector,
                     # the bug would show up 60 to 75% of the time. I think that leaving
                     # this sleep here is the only way to ensure that that particular
                     # bug stays fixed.
-                    time.sleep ( self.nap_time )
+                    time.sleep(self.nap_time)
         else:
-            #----------------------------------------------------------------
+            # ----------------------------------------------------------------
             # This is a payload message.
-            #----------------------------------------------------------------
+            # ----------------------------------------------------------------
             self.n_received += 1
             if self.state == 'examine_trace' :
-                trace    = event.message.annotations [ 'x-opt-qd.trace' ]
-                expected = self.expected_traces [ self.trace_count ]
+                trace    = event.message.annotations['x-opt-qd.trace']
+                expected = self.expected_traces[self.trace_count]
                 if trace == expected :
                     if self.trace_count == len(self.expected_traces) - 1 :
-                        self.state_transition ( 'final expected trace %s observed' % expected, 'bailing' )
-                        self.bail ( None )
+                        self.state_transition('final expected trace %s observed' % expected, 'bailing')
+                        self.bail(None)
                         return
-                    self.state_transition ( "expected trace %d observed successfully %s" % ( self.trace_count, expected ) , 'kill_connector' )
-                    self.kill_a_connector ( self.kill_list[self.trace_count] )
+                    self.state_transition("expected trace %d observed successfully %s" % (self.trace_count, expected), 'kill_connector')
+                    self.kill_a_connector(self.kill_list[self.trace_count])
                     self.trace_count += 1
                 else :
-                    self.state_transition ( "expected trace %s but got %s" % ( expected, trace ), 'bailing' )
-                    self.bail ( "expected trace %s but got %s" % ( expected, trace ) )
+                    self.state_transition("expected trace %s but got %s" % (expected, trace), 'bailing')
+                    self.bail("expected trace %s but got %s" % (expected, trace))
 
-
-    def on_accepted ( self, event ):
+    def on_accepted(self, event):
         self.n_accepted += 1
 
-
-    def on_released ( self, event ) :
+    def on_released(self, event) :
         self.n_released += 1
 
+    def connector_check(self, router, connector) :
+        self.debug_print("checking connector for router %s" % router)
+        mgmt_helper = self.routers[router]['mgmt_helper']
+        mgmt_sender = self.routers[router]['mgmt_sender']
+        msg = mgmt_helper.make_connector_query(connector)
+        mgmt_sender.send(msg)
 
-    def connector_check ( self, router, connector ) :
-        self.debug_print ( "checking connector for router %s" % router )
-        mgmt_helper = self.routers[router] ['mgmt_helper']
-        mgmt_sender = self.routers[router] ['mgmt_sender']
-        msg = mgmt_helper.make_connector_query ( connector )
-        mgmt_sender.send ( msg )
-
-
-    def kill_a_connector ( self, target ) :
+    def kill_a_connector(self, target) :
         router = target[0]
         connector = target[1]
-        self.debug_print ( "killing connector %s on router %s" % (connector, router) )
-        mgmt_helper = self.routers[router] ['mgmt_helper']
-        mgmt_sender = self.routers[router] ['mgmt_sender']
-        msg = mgmt_helper.make_connector_delete_command ( connector )
-        mgmt_sender.send ( msg )
-
-
+        self.debug_print("killing connector %s on router %s" % (connector, router))
+        mgmt_helper = self.routers[router]['mgmt_helper']
+        mgmt_sender = self.routers[router]['mgmt_sender']
+        msg = mgmt_helper.make_connector_delete_command(connector)
+        mgmt_sender.send(msg)
 
     def run(self):
         Container(self).run()
diff --git a/tests/system_tests_topology_addition.py b/tests/system_tests_topology_addition.py
index d378462..6114f51 100644
--- a/tests/system_tests_topology_addition.py
+++ b/tests/system_tests_topology_addition.py
@@ -22,53 +22,54 @@
 from __future__ import absolute_import
 from __future__ import print_function
 
-import unittest, os, json
-from subprocess      import PIPE, STDOUT
-from proton          import Message, Timeout
-from system_test     import TestCase, Qdrouterd, main_module, DIR, TIMEOUT, Process
+import unittest
+import os
+import json
+from subprocess import PIPE, STDOUT
+from proton import Message, Timeout
+from system_test import TestCase, Qdrouterd, main_module, DIR, TIMEOUT, Process
 from proton.handlers import MessagingHandler
-from proton.reactor  import Container, AtMostOnce, AtLeastOnce, DynamicNodeProperties, LinkOption, ApplicationEvent, EventInjector
-from proton.utils    import BlockingConnection
+from proton.reactor import Container, AtMostOnce, AtLeastOnce, DynamicNodeProperties, LinkOption, ApplicationEvent, EventInjector
+from proton.utils import BlockingConnection
 from qpid_dispatch.management.client import Node
 
 import time
 import datetime
 
-#====================================================
+# ====================================================
 # Helper classes for all tests.
-#====================================================
+# ====================================================
 
 
 # Named timers allow test code to distinguish between several
 # simultaneous timers, going off at different rates.
-class Timeout ( object ):
+class Timeout (object):
     def __init__(self, parent, name):
         self.parent = parent
         self.name   = name
 
     def on_timer_task(self, event):
-        self.parent.timeout ( self.name )
+        self.parent.timeout(self.name)
 
 
-
-#================================================================
+# ================================================================
 #     Setup
-#================================================================
+# ================================================================
 
-class TopologyAdditionTests ( TestCase ):
+class TopologyAdditionTests (TestCase):
 
     @classmethod
     def setUpClass(cls):
         super(TopologyAdditionTests, cls).setUpClass()
 
-        def router ( name, more_config ):
+        def router(name, more_config):
 
-            config = [ ('router',  {'mode': 'interior', 'id': name}),
-                       ('address', {'prefix': 'closest',   'distribution': 'closest'}),
-                       ('address', {'prefix': 'balanced',  'distribution': 'balanced'}),
-                       ('address', {'prefix': 'multicast', 'distribution': 'multicast'})
-                     ]      \
-                     + more_config
+            config = [('router',  {'mode': 'interior', 'id': name}),
+                      ('address', {'prefix': 'closest',   'distribution': 'closest'}),
+                      ('address', {'prefix': 'balanced',  'distribution': 'balanced'}),
+                      ('address', {'prefix': 'multicast', 'distribution': 'multicast'})
+                      ]      \
+                + more_config
 
             config = Qdrouterd.Config(config)
 
@@ -93,44 +94,44 @@
         # Only routers A and B are set up initially by this class.
         # Routers C and D are started by the test itself.
         router_A_config = [
-                            ( 'listener',
-                              { 'port': client_ports['A'],
-                                'role': 'normal',
-                                'stripAnnotations': 'no'
-                              }
-                            ),
-                            ( 'listener',
-                              {  'role': 'inter-router',
-                                 'port': cls.inter_router_ports['A']
-                              }
-                            )
-                         ]
+            ('listener',
+             {'port': client_ports['A'],
+              'role': 'normal',
+              'stripAnnotations': 'no'
+              }
+             ),
+            ('listener',
+             {'role': 'inter-router',
+              'port': cls.inter_router_ports['A']
+              }
+             )
+        ]
 
         router_B_config = [
-                            ( 'listener',
-                              { 'port': client_ports['B'],
-                                'role': 'normal',
-                                'stripAnnotations': 'no'
-                              }
-                            ),
-                            ( 'listener',
-                              { 'role': 'inter-router',
-                                'port': cls.inter_router_ports['B'],
-                                'stripAnnotations': 'no'
-                              }
-                            ),
-                            ( 'connector',
-                              {  'name': 'AB_connector',
-                                 'role': 'inter-router',
-                                 'port': cls.inter_router_ports['A'],
-                                 'cost':  initial_cost,
-                                 'stripAnnotations': 'no'
-                              }
-                            )
-                         ]
+            ('listener',
+             {'port': client_ports['B'],
+              'role': 'normal',
+              'stripAnnotations': 'no'
+              }
+             ),
+            ('listener',
+             {'role': 'inter-router',
+              'port': cls.inter_router_ports['B'],
+              'stripAnnotations': 'no'
+              }
+             ),
+            ('connector',
+             {'name': 'AB_connector',
+              'role': 'inter-router',
+              'port': cls.inter_router_ports['A'],
+              'cost': initial_cost,
+              'stripAnnotations': 'no'
+              }
+             )
+        ]
 
-        router ( 'A', router_A_config )
-        router ( 'B', router_B_config )
+        router('A', router_A_config)
+        router('B', router_B_config)
 
         router_A = cls.routers[0]
         router_B = cls.routers[1]
@@ -140,86 +141,82 @@
         cls.A_addr = router_A.addresses[0]
         cls.B_addr = router_B.addresses[0]
 
-
-
         # The two connections that this router will make, AC and BC,
         # will be lower cost than the direct AB route that the network
         # already has.
         cls.router_C_config = [
-                                ( 'listener',
-                                  { 'port': client_ports['C'],
-                                    'role': 'normal',
-                                    'stripAnnotations': 'no'
-                                  }
-                                ),
-                                ( 'connector',
-                                  {  'name': 'AC_connector',
-                                     'role': 'inter-router',
-                                     'port': cls.inter_router_ports['A'],
-                                     'cost':  int(lower_cost / 2),
-                                     'stripAnnotations': 'no',
-                                     'linkCapacity' : 1000
-                                  }
-                                ),
-                                ( 'connector',
-                                  {  'name': 'BC_connector',
-                                     'role': 'inter-router',
-                                     'port': cls.inter_router_ports['B'],
-                                     'cost':  int(lower_cost / 2),
-                                     'stripAnnotations': 'no',
-                                     'linkCapacity' : 1000
-                                  }
-                                )
-                              ]
+            ('listener',
+             {'port': client_ports['C'],
+              'role': 'normal',
+              'stripAnnotations': 'no'
+              }
+             ),
+            ('connector',
+             {'name': 'AC_connector',
+              'role': 'inter-router',
+              'port': cls.inter_router_ports['A'],
+              'cost': int(lower_cost / 2),
+              'stripAnnotations': 'no',
+              'linkCapacity' : 1000
+              }
+             ),
+            ('connector',
+             {'name': 'BC_connector',
+              'role': 'inter-router',
+              'port': cls.inter_router_ports['B'],
+              'cost': int(lower_cost / 2),
+              'stripAnnotations': 'no',
+              'linkCapacity' : 1000
+              }
+             )
+        ]
 
         # The two connections that this router will make, AD and BD,
         # will be higher cost than the other paths the networks already has
         # available to get from A to B.
         cls.router_D_config = [
-                                ( 'listener',
-                                  { 'port': client_ports['D'],
-                                    'role': 'normal',
-                                    'stripAnnotations': 'no'
-                                  }
-                                ),
-                                ( 'connector',
-                                  {  'name': 'AD_connector',
-                                     'role': 'inter-router',
-                                     'port': cls.inter_router_ports['A'],
-                                     'cost':  int(higher_cost / 2),
-                                     'stripAnnotations': 'no',
-                                     'linkCapacity' : 1000
-                                  }
-                                ),
-                                ( 'connector',
-                                  {  'name': 'BD_connector',
-                                     'role': 'inter-router',
-                                     'port': cls.inter_router_ports['B'],
-                                     'cost':  int(higher_cost / 2),
-                                     'stripAnnotations': 'no',
-                                     'linkCapacity' : 1000
-                                  }
-                                )
-                              ]
-
-
+            ('listener',
+             {'port': client_ports['D'],
+              'role': 'normal',
+              'stripAnnotations': 'no'
+              }
+             ),
+            ('connector',
+             {'name': 'AD_connector',
+              'role': 'inter-router',
+              'port': cls.inter_router_ports['A'],
+              'cost': int(higher_cost / 2),
+              'stripAnnotations': 'no',
+              'linkCapacity' : 1000
+              }
+             ),
+            ('connector',
+             {'name': 'BD_connector',
+              'role': 'inter-router',
+              'port': cls.inter_router_ports['B'],
+              'cost': int(higher_cost / 2),
+              'stripAnnotations': 'no',
+              'linkCapacity' : 1000
+              }
+             )
+        ]
 
     # This method allows test code to add new routers during the test,
     # rather than only at startup like A and B above.
-    def addRouter ( self, name, more_config ) :
-        config = [ ('router',  {'mode': 'interior', 'id': name}),
-                   ('address', {'prefix': 'closest',   'distribution': 'closest'}),
-                   ('address', {'prefix': 'balanced',  'distribution': 'balanced'}),
-                   ('address', {'prefix': 'multicast', 'distribution': 'multicast'})
-                 ]    \
-                 + more_config
+
+    def addRouter(self, name, more_config) :
+        config = [('router',  {'mode': 'interior', 'id': name}),
+                  ('address', {'prefix': 'closest',   'distribution': 'closest'}),
+                  ('address', {'prefix': 'balanced',  'distribution': 'balanced'}),
+                  ('address', {'prefix': 'multicast', 'distribution': 'multicast'})
+                  ]    \
+            + more_config
 
         config = Qdrouterd.Config(config)
 
         TopologyAdditionTests.routers.append(TopologyAdditionTests.tester.qdrouterd(name, config, wait=True))
 
-
-    def test_01_new_route_low_cost ( self ):
+    def test_01_new_route_low_cost(self):
         # During the test, test code will add a new router C,
         # connecting A and B with new low-cost links. At that
         # point the test's messages should switch from using
@@ -232,25 +229,23 @@
         # Since this test alters the path that the messages follow,
         # it is OK for some messages to be released rather than
         # delivered. It doesn't always happen - depends on timing.
-        initial_expected_trace = [ '0/A', '0/B' ]
-        final_expected_trace   = [ '0/A', '0/C', '0/B' ]
+        initial_expected_trace = ['0/A', '0/B']
+        final_expected_trace   = ['0/A', '0/C', '0/B']
         released_ok = True
 
-        test = AddRouter ( self.A_addr,
-                           self.B_addr,
-                           "closest/01",
-                           self,
-                           'C',
-                           self.router_C_config,
-                           [ initial_expected_trace, final_expected_trace ],
-                           released_ok
+        test = AddRouter(self.A_addr,
+                         self.B_addr,
+                         "closest/01",
+                         self,
+                         'C',
+                         self.router_C_config,
+                         [initial_expected_trace, final_expected_trace],
+                         released_ok
                          )
         test.run()
-        self.assertEqual ( None, test.error )
+        self.assertEqual(None, test.error)
 
-
-
-    def test_02_new_route_high_cost ( self ):
+    def test_02_new_route_high_cost(self):
         # During the test, test code will add a new router D,
         # connecting A and B with new links. But the links are
         # higher cost than what already exist. The network should
@@ -263,30 +258,28 @@
         # Since this test does not alter the path that the messages
         # follow, it is *not* OK for any messages to be released
         # rather than delivered.
-        only_expected_trace   = [ '0/A', '0/C', '0/B' ]
+        only_expected_trace   = ['0/A', '0/C', '0/B']
         released_ok = False
 
-        test = AddRouter ( self.A_addr,
-                           self.B_addr,
-                           "closest/02",
-                           self,
-                           'D',
-                           self.router_D_config,
-                           [ only_expected_trace ],
-                           released_ok
+        test = AddRouter(self.A_addr,
+                         self.B_addr,
+                         "closest/02",
+                         self,
+                         'D',
+                         self.router_D_config,
+                         [only_expected_trace],
+                         released_ok
                          )
         test.run()
-        self.assertEqual ( None, test.error )
+        self.assertEqual(None, test.error)
 
 
-
-
-#================================================================
+# ================================================================
 #     Tests
-#================================================================
+# ================================================================
 
 
-#--------------------------------------------------------------
+# --------------------------------------------------------------
 #
 # First test
 # ------------------
@@ -329,18 +322,18 @@
 # As in the first test, the caller tells us what routes ought
 # to be followed, by putting them in the 'expected_traces' arg.
 #
-#--------------------------------------------------------------
+# --------------------------------------------------------------
 
-class AddRouter ( MessagingHandler ):
-    def __init__ ( self,
-                   send_addr,
-                   recv_addr,
-                   destination,
-                   parent,
-                   new_router_name,
-                   new_router_config,
-                   expected_traces,
-                   released_ok
+class AddRouter (MessagingHandler):
+    def __init__(self,
+                 send_addr,
+                 recv_addr,
+                 destination,
+                 parent,
+                 new_router_name,
+                 new_router_config,
+                 expected_traces,
+                 released_ok
                  ):
         super(AddRouter, self).__init__(prefetch=100)
         self.send_addr         = send_addr
@@ -373,16 +366,14 @@
         # Make a little data structure that
         # will keep track of how many times each trace was seen.
         self.expected_trace_counts = list()
-        for i in range ( len(expected_traces )) :
-            self.expected_trace_counts.append ( [ expected_traces[i], 0 ] )
+        for i in range(len(expected_traces)) :
+            self.expected_trace_counts.append([expected_traces[i], 0])
 
-
-    def run ( self ) :
+    def run(self) :
         Container(self).run()
 
-
     # Close everything and allow the test to terminate.
-    def bail ( self, reason_for_bailing ) :
+    def bail(self, reason_for_bailing) :
         self.finishing = True
         self.error = reason_for_bailing
         self.receiver.close()
@@ -391,19 +382,18 @@
         self.test_timer.cancel()
         self.send_timer.cancel()
 
-
     # There are two timers. The 'test' timer should only expire if
     # something has gone wrong, in which case it terminates the test.
     # The 'send' timer expires frequently, and every time it goes off
     # we send out a little batch of messages.
-    def timeout ( self, name ):
+    def timeout(self, name):
 
         if self.finishing :
             return
 
         self.timeout_count += 1
         if name == "test" :
-            self.bail ( "Timeout Expired: %d messages received, %d expected." % (self.n_received, self.n_messages) )
+            self.bail("Timeout Expired: %d messages received, %d expected." % (self.n_received, self.n_messages))
         elif name == "send" :
             self.send()
             self.send_timer = self.reactor.schedule(1, Timeout(self, "send"))
@@ -414,8 +404,7 @@
             # network, and some will flow through the network with
             # the new router added.
             if self.timeout_count == 5 :
-                self.parent.addRouter ( self.new_router_name, self.new_router_config )
-
+                self.parent.addRouter(self.new_router_name, self.new_router_config)
 
     def on_start(self, event):
         self.reactor   = event.reactor
@@ -429,12 +418,11 @@
 
         self.sender      = event.container.create_sender(self.send_conn, self.dest)
         self.receiver    = event.container.create_receiver(self.recv_conn, self.dest)
-        self.receiver.flow ( self.n_messages )
+        self.receiver.flow(self.n_messages)
 
-
-    #------------------------------------------------------------
+    # ------------------------------------------------------------
     # Sender Side
-    #------------------------------------------------------------
+    # ------------------------------------------------------------
 
     def send(self):
 
@@ -449,21 +437,18 @@
             if self.n_sent == self.n_messages :
                 return
 
-
     # The caller of this tests decides whether it is OK or
     # not OK to have some messages released during the test.
-    def on_released ( self, event ) :
+    def on_released(self, event) :
         if self.released_ok :
             self.n_released += 1
-            self.check_count ( )
+            self.check_count()
         else :
-            self.bail ( "a message was released." )
+            self.bail("a message was released.")
 
-
-    def on_accepted ( self, event ) :
+    def on_accepted(self, event) :
         self.n_accepted += 1
-        self.check_count ( )
-
+        self.check_count()
 
     #
     # Do the released plus the accepted messages add up to the number
@@ -479,47 +464,43 @@
     #   all sent messages -- whether they have been accepted by the receiver,
     #   or released by the router network.
     #
-    def check_count ( self ) :
+    def check_count(self) :
         if self.n_accepted + self.n_released == self.n_messages :
             self.finishing = True
-            self.finish_test ( )
+            self.finish_test()
 
-
-
-    #------------------------------------------------------------
+    # ------------------------------------------------------------
     # Receiver Side
-    #------------------------------------------------------------
+    # ------------------------------------------------------------
 
     def on_message(self, event):
         if self.finishing :
             return
         self.n_received += 1
-        trace = event.message.annotations [ 'x-opt-qd.trace' ]
+        trace = event.message.annotations['x-opt-qd.trace']
         # Introduce flaws for debugging.
         # if self.n_received == 13 :
         #     trace = [ '0/B', '0/A', '0/D' ]
         # if self.n_received == 13 :
         #     self.n_received -= 1
-        self.record_trace ( trace )
-        self.check_count ( )
-
+        self.record_trace(trace)
+        self.check_count()
 
     # Compare the trace that came from a message to the list of
     # traces the caller told us to expect. If it is one of the
     # expected traces, count it. Otherwise, fail the test.
-    def record_trace ( self, observed_trace ):
+    def record_trace(self, observed_trace):
         for trace_record in self.expected_trace_counts :
-            trace = trace_record [ 0 ]
+            trace = trace_record[0]
             if observed_trace == trace :
-                trace_record [ 1 ] += 1
+                trace_record[1] += 1
                 return
         # If we get here, the trace is one we were not expecting. That's bad.
-        self.bail ( "Unexpected trace: %s" % observed_trace )
-
+        self.bail("Unexpected trace: %s" % observed_trace)
 
     # Shut down everything and make sure that all of the extected traces
     # have been seen.
-    def finish_test ( self ) :
+    def finish_test(self) :
         self.test_timer.cancel()
         self.send_timer.cancel()
         for trace_record in self.expected_trace_counts :
@@ -527,12 +508,11 @@
             # Deliberate flaw for debugging.
             # count = 0
             if count <= 0 :
-                self.bail ( "Trace %s was not seen." % trace_record[0] )
+                self.bail("Trace %s was not seen." % trace_record[0])
                 return
 
         # success
-        self.bail ( None )
-
+        self.bail(None)
 
 
 if __name__ == '__main__':
diff --git a/tests/system_tests_topology_disposition.py.in b/tests/system_tests_topology_disposition.py.in
index b24c603..0ef2800 100644
--- a/tests/system_tests_topology_disposition.py.in
+++ b/tests/system_tests_topology_disposition.py.in
@@ -22,13 +22,15 @@
 from __future__ import absolute_import
 from __future__ import print_function
 
-import unittest, os, json
-from subprocess      import PIPE, STDOUT
-from proton          import Message, SSLDomain, SSLUnavailable, Timeout
-from system_test     import TestCase, Qdrouterd, main_module, DIR, TIMEOUT, Process
+import unittest
+import os
+import json
+from subprocess import PIPE, STDOUT
+from proton import Message, SSLDomain, SSLUnavailable, Timeout
+from system_test import TestCase, Qdrouterd, main_module, DIR, TIMEOUT, Process
 from proton.handlers import MessagingHandler
-from proton.reactor  import Container, AtMostOnce, AtLeastOnce, DynamicNodeProperties, LinkOption, ApplicationEvent, EventInjector
-from proton.utils    import BlockingConnection
+from proton.reactor import Container, AtMostOnce, AtLeastOnce, DynamicNodeProperties, LinkOption, ApplicationEvent, EventInjector
+from proton.utils import BlockingConnection
 from qpid_dispatch.management.client import Node
 from qpid_dispatch_internal.compat import UNICODE
 
@@ -39,90 +41,87 @@
 import sys
 
 
-#================================================
+# ================================================
 # Helper classes for all tests.
-#================================================
+# ================================================
 
-class Stopwatch ( object ) :
+class Stopwatch (object) :
 
-    def __init__ ( self, name, timer, initial_time, repeat_time ) :
+    def __init__(self, name, timer, initial_time, repeat_time) :
         self.name         = name
         self.timer        = timer
         self.initial_time = initial_time
         self.repeat_time  = repeat_time
 
 
-
 class Timeout(object):
     """
     Named timeout object can handle multiple simultaneous
     timers, by telling the parent which one fired.
     """
-    def __init__ ( self, parent, name ):
+
+    def __init__(self, parent, name):
         self.parent = parent
         self.name   = name
 
-    def on_timer_task ( self, event ):
-        self.parent.timeout ( self.name )
+    def on_timer_task(self, event):
+        self.parent.timeout(self.name)
 
 
-
-class ManagementMessageHelper ( object ) :
+class ManagementMessageHelper (object) :
     """
     Format management messages.
     """
-    def __init__ ( self, reply_addr ) :
+
+    def __init__(self, reply_addr) :
         self.reply_addr = reply_addr
 
-    def make_connector_query ( self, connector_name ) :
-        props = {'operation': 'READ', 'type': 'org.apache.qpid.dispatch.connector', 'name' : connector_name }
-        msg = Message ( properties=props, reply_to=self.reply_addr )
+    def make_connector_query(self, connector_name) :
+        props = {'operation': 'READ', 'type': 'org.apache.qpid.dispatch.connector', 'name' : connector_name}
+        msg = Message(properties=props, reply_to=self.reply_addr)
         return msg
 
-    def make_connector_delete_command ( self, connector_name ) :
-        props = {'operation': 'DELETE', 'type': 'org.apache.qpid.dispatch.connector', 'name' : connector_name }
-        msg = Message ( properties=props, reply_to=self.reply_addr )
+    def make_connector_delete_command(self, connector_name) :
+        props = {'operation': 'DELETE', 'type': 'org.apache.qpid.dispatch.connector', 'name' : connector_name}
+        msg = Message(properties=props, reply_to=self.reply_addr)
         return msg
 
-    def make_router_link_query ( self ) :
-        props = { 'count':      '100',
-                  'operation':  'QUERY',
-                  'entityType': 'org.apache.qpid.dispatch.router.link',
-                  'name':       'self',
-                  'type':       'org.amqp.management'
-                }
+    def make_router_link_query(self) :
+        props = {'count':      '100',
+                 'operation':  'QUERY',
+                 'entityType': 'org.apache.qpid.dispatch.router.link',
+                 'name':       'self',
+                 'type':       'org.amqp.management'
+                 }
         attrs = []
-        attrs.append ( UNICODE('linkType') )
-        attrs.append ( UNICODE('linkDir') )
-        attrs.append ( UNICODE('linkName') )
-        attrs.append ( UNICODE('owningAddr') )
-        attrs.append ( UNICODE('capacity') )
-        attrs.append ( UNICODE('undeliveredCount') )
-        attrs.append ( UNICODE('unsettledCount') )
-        attrs.append ( UNICODE('acceptedCount') )
-        attrs.append ( UNICODE('rejectedCount') )
-        attrs.append ( UNICODE('releasedCount') )
-        attrs.append ( UNICODE('modifiedCount') )
+        attrs.append(UNICODE('linkType'))
+        attrs.append(UNICODE('linkDir'))
+        attrs.append(UNICODE('linkName'))
+        attrs.append(UNICODE('owningAddr'))
+        attrs.append(UNICODE('capacity'))
+        attrs.append(UNICODE('undeliveredCount'))
+        attrs.append(UNICODE('unsettledCount'))
+        attrs.append(UNICODE('acceptedCount'))
+        attrs.append(UNICODE('rejectedCount'))
+        attrs.append(UNICODE('releasedCount'))
+        attrs.append(UNICODE('modifiedCount'))
 
-        msg_body = { }
-        msg_body [ 'attributeNames' ] = attrs
-        return Message ( body=msg_body, properties=props, reply_to=self.reply_addr )
+        msg_body = {}
+        msg_body['attributeNames'] = attrs
+        return Message(body=msg_body, properties=props, reply_to=self.reply_addr)
 
 
-#================================================
+# ================================================
 # END Helper classes for all tests.
-#================================================
+# ================================================
 
 
-
-
-
-#================================================================
+# ================================================================
 #     Setup
-#================================================================
+# ================================================================
 
 
-class TopologyDispositionTests ( TestCase ):
+class TopologyDispositionTests (TestCase):
     """
     The disposition guarantee is that the sender should shortly know
     how its messages have been disposed: whether they have been
@@ -135,34 +134,31 @@
     def setUpClass(cls):
         super(TopologyDispositionTests, cls).setUpClass()
 
-
         cls.routers = []
 
-
         def router(name, more_config):
 
-            config = [ ('router',  {'mode': 'interior', 'id': name}),
-                       ('address', {'prefix': 'closest',   'distribution': 'closest'}),
-                       ('address', {'prefix': 'balanced',  'distribution': 'balanced'}),
-                       ('address', {'prefix': 'multicast', 'distribution': 'multicast'})
-                     ]    \
-                     + more_config
+            config = [('router',  {'mode': 'interior', 'id': name}),
+                      ('address', {'prefix': 'closest',   'distribution': 'closest'}),
+                      ('address', {'prefix': 'balanced',  'distribution': 'balanced'}),
+                      ('address', {'prefix': 'multicast', 'distribution': 'multicast'})
+                      ]    \
+                + more_config
 
             config = Qdrouterd.Config(config)
 
             cls.routers.append(cls.tester.qdrouterd(name, config, wait=True))
 
-
         client_ports = dict()
-        client_ports [ 'A' ] = cls.tester.get_port()
-        client_ports [ 'B' ] = cls.tester.get_port()
-        client_ports [ 'C' ] = cls.tester.get_port()
-        client_ports [ 'D' ] = cls.tester.get_port()
+        client_ports['A'] = cls.tester.get_port()
+        client_ports['B'] = cls.tester.get_port()
+        client_ports['C'] = cls.tester.get_port()
+        client_ports['D'] = cls.tester.get_port()
 
         inter_router_ports = dict()
-        inter_router_ports [ 'A' ] = cls.tester.get_port()
-        inter_router_ports [ 'B' ] = cls.tester.get_port()
-        inter_router_ports [ 'C' ] = cls.tester.get_port()
+        inter_router_ports['A'] = cls.tester.get_port()
+        inter_router_ports['B'] = cls.tester.get_port()
+        inter_router_ports['C'] = cls.tester.get_port()
 
         #
         #
@@ -183,12 +179,12 @@
         #
 
         cls.cost = dict()
-        cls.cost [ 'AB' ] = 100
-        cls.cost [ 'AC' ] =  50
-        cls.cost [ 'AD' ] =   2
-        cls.cost [ 'BC' ] =   4
-        cls.cost [ 'BD' ] =  20
-        cls.cost [ 'CD' ] =   3
+        cls.cost['AB'] = 100
+        cls.cost['AC'] =  50
+        cls.cost['AD'] =   2
+        cls.cost['BC'] =   4
+        cls.cost['BD'] =  20
+        cls.cost['CD'] =   3
 
         # Add an extra, high-cost connection between A and D.
         # This will be deleted in the first test. Note that
@@ -197,155 +193,151 @@
         # Any of the connections may be used and the others are
         # ignored. The multiple connections do not act as a
         # "hot standby" nor as a "trunking" setup where the
-        # traffic between the routers is shared across the 
+        # traffic between the routers is shared across the
         # connections.
         # If the active connection is lost then the multiple
         # connections are all considered for election and one
-        # of them is chosen. The router does not seamlessly 
+        # of them is chosen. The router does not seamlessly
         # transfer the load to the unaffected connection.
 
-        cls.cost [ 'AD2' ] =  11
+        cls.cost['AD2'] =  11
 
         client_link_capacity       = 1000
         inter_router_link_capacity = 1000
 
-        router ( 'A',
-                 [
-                    ( 'listener',
-                      { 'port': client_ports['A'],
-                        'role': 'normal',
-                        'stripAnnotations': 'no',
-                        'linkCapacity' : client_link_capacity
-                      }
+        router('A',
+               [
+                   ('listener',
+                    {'port': client_ports['A'],
+                     'role': 'normal',
+                     'stripAnnotations': 'no',
+                     'linkCapacity' : client_link_capacity
+                     }
                     ),
-                    ( 'listener',
-                      { 'role': 'inter-router',
-                        'port': inter_router_ports [ 'A' ],
-                        'stripAnnotations': 'no',
-                        'linkCapacity' : inter_router_link_capacity
-                      }
+                   ('listener',
+                    {'role': 'inter-router',
+                     'port': inter_router_ports['A'],
+                     'stripAnnotations': 'no',
+                     'linkCapacity' : inter_router_link_capacity
+                     }
                     )
-                 ]
+               ]
                )
 
-
-        router ( 'B',
-                 [
-                    ( 'listener',
-                      { 'port': client_ports['B'],
-                        'role': 'normal',
-                        'stripAnnotations': 'no',
-                        'linkCapacity' : client_link_capacity
-                      }
+        router('B',
+               [
+                   ('listener',
+                    {'port': client_ports['B'],
+                     'role': 'normal',
+                     'stripAnnotations': 'no',
+                     'linkCapacity' : client_link_capacity
+                     }
                     ),
-                    ( 'listener',
-                      { 'role': 'inter-router',
-                        'port': inter_router_ports [ 'B' ],
-                        'stripAnnotations': 'no',
-                        'linkCapacity' : inter_router_link_capacity
-                      }
+                   ('listener',
+                    {'role': 'inter-router',
+                     'port': inter_router_ports['B'],
+                     'stripAnnotations': 'no',
+                     'linkCapacity' : inter_router_link_capacity
+                     }
                     ),
-                    # The names on the connectors are what allows me to kill them later.
-                    ( 'connector',
-                      {  'name': 'AB_connector',
-                         'role': 'inter-router',
-                         'port': inter_router_ports [ 'A' ],
-                         'cost':  cls.cost['AB'],
-                         'stripAnnotations': 'no',
-                         'linkCapacity' : inter_router_link_capacity
-                      }
+                   # The names on the connectors are what allows me to kill them later.
+                   ('connector',
+                    {'name': 'AB_connector',
+                     'role': 'inter-router',
+                     'port': inter_router_ports['A'],
+                     'cost':  cls.cost['AB'],
+                     'stripAnnotations': 'no',
+                     'linkCapacity' : inter_router_link_capacity
+                     }
                     )
-                 ]
+               ]
                )
 
-
-        router ( 'C',
-                 [
-                    ( 'listener',
-                      { 'port': client_ports['C'],
-                        'role': 'normal',
-                        'stripAnnotations': 'no',
-                        'linkCapacity' : client_link_capacity
-                      }
+        router('C',
+               [
+                   ('listener',
+                    {'port': client_ports['C'],
+                     'role': 'normal',
+                     'stripAnnotations': 'no',
+                     'linkCapacity' : client_link_capacity
+                     }
                     ),
-                    ( 'listener',
-                      { 'role': 'inter-router',
-                        'port': inter_router_ports [ 'C' ],
-                        'stripAnnotations': 'no',
-                        'linkCapacity' : inter_router_link_capacity
-                      }
+                   ('listener',
+                    {'role': 'inter-router',
+                     'port': inter_router_ports['C'],
+                     'stripAnnotations': 'no',
+                     'linkCapacity' : inter_router_link_capacity
+                     }
                     ),
-                    ( 'connector',
-                      {  'name': 'AC_connector',
-                         'role': 'inter-router',
-                         'port': inter_router_ports [ 'A' ],
-                         'cost' : cls.cost['AC'],
-                         'stripAnnotations': 'no',
-                         'linkCapacity' : inter_router_link_capacity
-                      }
+                   ('connector',
+                    {'name': 'AC_connector',
+                     'role': 'inter-router',
+                     'port': inter_router_ports['A'],
+                     'cost' : cls.cost['AC'],
+                     'stripAnnotations': 'no',
+                     'linkCapacity' : inter_router_link_capacity
+                     }
                     ),
-                    ( 'connector',
-                      {  'name': 'BC_connector',
-                         'role': 'inter-router',
-                         'port': inter_router_ports [ 'B' ],
-                         'cost' : cls.cost['BC'],
-                         'stripAnnotations': 'no',
-                         'linkCapacity' : inter_router_link_capacity
-                      }
+                   ('connector',
+                    {'name': 'BC_connector',
+                     'role': 'inter-router',
+                     'port': inter_router_ports['B'],
+                     'cost' : cls.cost['BC'],
+                     'stripAnnotations': 'no',
+                     'linkCapacity' : inter_router_link_capacity
+                     }
                     )
-                 ]
+               ]
                )
 
-
-        router ( 'D',
-                 [
-                    ( 'listener',
-                      { 'port': client_ports['D'],
-                        'role': 'normal',
-                        'stripAnnotations': 'no',
-                        'linkCapacity' : client_link_capacity
-                      }
+        router('D',
+               [
+                   ('listener',
+                    {'port': client_ports['D'],
+                     'role': 'normal',
+                     'stripAnnotations': 'no',
+                     'linkCapacity' : client_link_capacity
+                     }
                     ),
-                    ( 'connector',
-                      {  'name': 'AD_connector',
-                         'role': 'inter-router',
-                         'port': inter_router_ports [ 'A' ],
-                         'cost' : cls.cost['AD'],
-                         'stripAnnotations': 'no',
-                         'linkCapacity' : inter_router_link_capacity
-                      }
+                   ('connector',
+                    {'name': 'AD_connector',
+                     'role': 'inter-router',
+                     'port': inter_router_ports['A'],
+                     'cost' : cls.cost['AD'],
+                     'stripAnnotations': 'no',
+                     'linkCapacity' : inter_router_link_capacity
+                     }
                     ),
-                    ( 'connector',
-                      {  'name': 'AD2_connector',
-                         'role': 'inter-router',
-                         'port': inter_router_ports [ 'A' ],
-                         'cost' : cls.cost['AD2'],
-                         'stripAnnotations': 'no',
-                         'linkCapacity' : inter_router_link_capacity
-                      }
+                   ('connector',
+                    {'name': 'AD2_connector',
+                     'role': 'inter-router',
+                     'port': inter_router_ports['A'],
+                     'cost' : cls.cost['AD2'],
+                     'stripAnnotations': 'no',
+                     'linkCapacity' : inter_router_link_capacity
+                     }
                     ),
-                    ( 'connector',
-                      {  'name': 'BD_connector',
-                         'role': 'inter-router',
-                         'port': inter_router_ports [ 'B' ],
-                         'cost' : cls.cost['BD'],
-                         'stripAnnotations': 'no',
-                         'linkCapacity' : inter_router_link_capacity
-                      }
+                   ('connector',
+                    {'name': 'BD_connector',
+                     'role': 'inter-router',
+                     'port': inter_router_ports['B'],
+                     'cost' : cls.cost['BD'],
+                     'stripAnnotations': 'no',
+                     'linkCapacity' : inter_router_link_capacity
+                     }
                     ),
-                    ( 'connector',
-                      {  'name': 'CD_connector',
-                         'role': 'inter-router',
-                         'port': inter_router_ports [ 'C' ],
-                         'cost' : cls.cost['CD'],
-                         'stripAnnotations': 'no',
-                         'linkCapacity' : inter_router_link_capacity
-                      }
+                   ('connector',
+                    {'name': 'CD_connector',
+                     'role': 'inter-router',
+                     'port': inter_router_ports['C'],
+                     'cost' : cls.cost['CD'],
+                     'stripAnnotations': 'no',
+                     'linkCapacity' : inter_router_link_capacity
+                     }
                     )
-                 ]
+               ]
                )
 
-
         router_A = cls.routers[0]
         router_B = cls.routers[1]
         router_C = cls.routers[2]
@@ -362,48 +354,45 @@
         cls.client_addrs['D'] = router_D.addresses[0]
 
         # 1 means skip that test.
-        cls.skip = { 'test_01' : 0,
-                     'test_02' : 0,
-                     'test_03' : 0,
-                     'test_04' : 0
-                   }
+        cls.skip = {'test_01' : 0,
+                    'test_02' : 0,
+                    'test_03' : 0,
+                    'test_04' : 0
+                    }
 
-
-    def test_01_delete_spurious_connector ( self ):
+    def test_01_delete_spurious_connector(self):
         name = 'test_01'
-        if self.skip [ name ] :
-            self.skipTest ( "Test skipped during development." )
-        test = DeleteSpuriousConnector ( name,
-                                         self.client_addrs,
-                                         'closest/01',
-                                         self.client_addrs['D']
+        if self.skip[name] :
+            self.skipTest("Test skipped during development.")
+        test = DeleteSpuriousConnector(name,
+                                       self.client_addrs,
+                                       'closest/01',
+                                       self.client_addrs['D']
                                        )
         test.run()
-        self.assertEqual ( None, test.error )
+        self.assertEqual(None, test.error)
 
-
-    def test_02_topology_disposition ( self ):
+    def test_02_topology_disposition(self):
         name = 'test_02'
-        if self.skip [ name ] :
-            self.skipTest ( "Test skipped during development." )
-        test = TopologyDisposition ( name,
-                                     self.client_addrs,
-                                     "closest/02"
+        if self.skip[name] :
+            self.skipTest("Test skipped during development.")
+        test = TopologyDisposition(name,
+                                   self.client_addrs,
+                                   "closest/02"
                                    )
         test.run()
-        self.assertEqual ( None, test.error )
+        self.assertEqual(None, test.error)
 
-
-    def test_03_connection_id_propagation ( self ):
+    def test_03_connection_id_propagation(self):
         name = 'test_03'
         error = None
-        if self.skip [ name ] :
-            self.skipTest ( "Test skipped during development." )
+        if self.skip[name] :
+            self.skipTest("Test skipped during development.")
         st_key = "PROTOCOL (trace) [C"
         qc_key = "qd.conn-id\"="
         for letter in ['A', 'B', 'C', 'D']:
             log_name = ('../setUpClass/%s.log' % letter)
-            with  open(log_name, 'r') as router_log:
+            with open(log_name, 'r') as router_log:
                 log_lines = router_log.read().split("\n")
                 outbound_opens = [s for s in log_lines if "-> @open" in s]
                 for oopen in outbound_opens:
@@ -423,24 +412,23 @@
                             break
                         sti += 1
                         qci += 1
-                    if error == None and oopen[qci].isdigit():
+                    if error is None and oopen[qci].isdigit():
                         error = "log %s, line '%s' published conn-id is too big" % (log_name, oopen)
                 self.assertEqual(None, error)
-            self.assertEqual ( None, error )
+            self.assertEqual(None, error)
 
-
-    def test_04_scraper_tool ( self ):
+    def test_04_scraper_tool(self):
         name = 'test_04'
         error = str(None)
-        if self.skip [ name ] :
-            self.skipTest ( "Test skipped during development." )
+        if self.skip[name] :
+            self.skipTest("Test skipped during development.")
 
         try:
             import ast
         except ImportError:
             # scraper requires ast which is not installed by default on all platforms
-            self.skipTest ( "Python ast module is not available on this platform." )
-        
+            self.skipTest("Python ast module is not available on this platform.")
+
         scraper_path = os.path.join(os.environ.get('BUILD_DIR'), 'tests', 'scraper', 'scraper.py')
 
         # aggregate all the log files
@@ -459,8 +447,8 @@
         if str(None) != error:
             print("Error text: ", error)
             sys.stdout.flush()
-        self.assertEqual ( str(None), error )
-        self.assertIn( '</body>', out )
+        self.assertEqual(str(None), error)
+        self.assertIn('</body>', out)
 
         # split A.log
         p = self.popen(['/usr/bin/env', '${PY_STRING}', scraper_path, '--split', '-f', '../setUpClass/A.log'],
@@ -475,8 +463,8 @@
         if str(None) != error:
             print("Error text: ", error)
             sys.stdout.flush()
-        self.assertEqual ( str(None), error )
-        self.assertIn( '</body>', out )
+        self.assertEqual(str(None), error)
+        self.assertIn('</body>', out)
 
 
 #################################################################
@@ -484,7 +472,7 @@
 #################################################################
 
 
-class DeleteSpuriousConnector ( MessagingHandler ):
+class DeleteSpuriousConnector (MessagingHandler):
     """
     Connect receiver (to B) and sender (to A) to router network.
     Start sending batches of messages to router A.
@@ -493,8 +481,9 @@
     Once messages are accepted then the route is fully established
     and messages must not be released after that.
     """
-    def __init__ ( self, test_name, client_addrs, destination, D_client_addr ):
-        super ( DeleteSpuriousConnector, self).__init__(prefetch=100)
+
+    def __init__(self, test_name, client_addrs, destination, D_client_addr):
+        super(DeleteSpuriousConnector, self).__init__(prefetch=100)
         self.test_name           = test_name
         self.client_addrs        = client_addrs
         self.D_client_addr       = D_client_addr
@@ -528,14 +517,12 @@
         self.first_released          = None
         self.first_received          = None
 
-
-    def debug_print ( self, text ) :
-        if self.debug == True:
-            print("%.6lf %s" % ( time.time(), text ))
-
+    def debug_print(self, text) :
+        if self.debug:
+            print("%.6lf %s" % (time.time(), text))
 
     # Shut down everything and exit.
-    def bail ( self, text ):
+    def bail(self, text):
         self.bailing = True
         self.error = text
 
@@ -543,175 +530,163 @@
             stopwatch.timer.cancel()
 
         for cnx in self.connections :
-            cnx.close ( )
-
+            cnx.close()
 
     # Call this from all handlers of dispositions returning to the sender.
-    def bail_out_if_done ( self ) :
+    def bail_out_if_done(self) :
         if self.n_accepted + self.n_released >= self.max_to_send()  :
             # We have received everything. But! Did we get a confirmed kill on the connector?
             if not self.confirmed_kill :
                 # This is a failure.
-                self.bail ( "No confirmed kill on connector." )
+                self.bail("No confirmed kill on connector.")
             else :
                 # Success!
-                self.bail ( None )
+                self.bail(None)
 
-
-    def timeout ( self, timer_name ):
+    def timeout(self, timer_name):
         # If we are in the process of punching out, ignore all other timers.
         if self.bailing :
             return
 
-        self.debug_print ( "timeout %s" % timer_name )
+        self.debug_print("timeout %s" % timer_name)
 
         # If this is the doomsday timer, just punch out.
         if timer_name == 'test' :
-            self.bail ( None )
+            self.bail(None)
             return
 
         # Timer-specific actions.
         if timer_name == 'sender' :
-            self.send ( )
+            self.send()
 
         # Generic actions for all timers.
         stopwatch = self.timers[timer_name]
-        stopwatch.timer = self.reactor.schedule ( stopwatch.repeat_time, Timeout(self, timer_name) )
+        stopwatch.timer = self.reactor.schedule(stopwatch.repeat_time, Timeout(self, timer_name))
 
-
-    def on_start ( self, event ):
+    def on_start(self, event):
         self.reactor = event.reactor
 
         # This stopwatch will end the test.
-        stopwatch_name='test'
-        init_time=60
+        stopwatch_name = 'test'
+        init_time = 60
         self.timers[stopwatch_name] = \
-            Stopwatch ( name = stopwatch_name, \
-                        timer = event.reactor.schedule(init_time, Timeout(self, stopwatch_name)), \
-                        initial_time = init_time, \
-                        repeat_time = 0 \
+            Stopwatch(name=stopwatch_name,
+                      timer=event.reactor.schedule(init_time, Timeout(self, stopwatch_name)),
+                      initial_time=init_time,
+                      repeat_time=0
                       )
 
         # This stopwatch calls the sender.
-        stopwatch_name='sender'
-        init_time=2
+        stopwatch_name = 'sender'
+        init_time = 2
         self.timers[stopwatch_name] = \
-            Stopwatch ( name = stopwatch_name, \
-                        timer = event.reactor.schedule(init_time, Timeout(self, stopwatch_name)), \
-                        initial_time = init_time, \
-                        repeat_time = 0.1 \
+            Stopwatch(name=stopwatch_name,
+                      timer=event.reactor.schedule(init_time, Timeout(self, stopwatch_name)),
+                      initial_time=init_time,
+                      repeat_time=0.1
                       )
 
-        self.sender_connection   = event.container.connect ( self.client_addrs['A'] )
-        self.receiver_connection = event.container.connect ( self.client_addrs['B'] )
-        self.connections.append ( self.sender_connection )
-        self.connections.append ( self.receiver_connection )
+        self.sender_connection   = event.container.connect(self.client_addrs['A'])
+        self.receiver_connection = event.container.connect(self.client_addrs['B'])
+        self.connections.append(self.sender_connection)
+        self.connections.append(self.receiver_connection)
 
-        self.sender   = event.container.create_sender   ( self.sender_connection,   self.dest, name='sender' )
-        self.receiver = event.container.create_receiver ( self.receiver_connection, self.dest, name='receiver' )
+        self.sender   = event.container.create_sender(self.sender_connection, self.dest, name='sender')
+        self.receiver = event.container.create_receiver(self.receiver_connection, self.dest, name='receiver')
 
         # In this test, we send a single management command to the D router
         # to kill a 'spurious', i.e. unused, connector.
-        self.D_management_connection = event.container.connect ( self.D_client_addr )
-        self.D_management_receiver   = event.container.create_receiver ( self.D_management_connection, dynamic=True )
-        self.D_management_sender     = event.container.create_sender   ( self.D_management_connection, "$management" )
-        self.connections.append ( self.D_management_connection )
+        self.D_management_connection = event.container.connect(self.D_client_addr)
+        self.D_management_receiver   = event.container.create_receiver(self.D_management_connection, dynamic=True)
+        self.D_management_sender     = event.container.create_sender(self.D_management_connection, "$management")
+        self.connections.append(self.D_management_connection)
 
-
-    def on_link_opened ( self, event ) :
-        self.debug_print ( "on_link_opened" )
+    def on_link_opened(self, event) :
+        self.debug_print("on_link_opened")
         if event.receiver:
-            event.receiver.flow ( self.n_messages )
+            event.receiver.flow(self.n_messages)
 
         if event.receiver == self.D_management_receiver :
-            event.receiver.flow ( 100 )
-            self.D_management_helper = ManagementMessageHelper ( event.receiver.remote_source.address )
-
+            event.receiver.flow(100)
+            self.D_management_helper = ManagementMessageHelper(event.receiver.remote_source.address)
 
     def run(self):
         Container(self).run()
 
-
-    def kill_the_connector ( self ) :
+    def kill_the_connector(self) :
         router = 'D'
         connector = 'AD2_connector'
-        self.debug_print ( "killing connector %s on router %s" % (connector, router) )
-        msg = self.D_management_helper.make_connector_delete_command ( connector )
-        self.debug_print ( "killing connector %s on router %s" % (connector, router) )
-        self.D_management_sender.send ( msg )
+        self.debug_print("killing connector %s on router %s" % (connector, router))
+        msg = self.D_management_helper.make_connector_delete_command(connector)
+        self.debug_print("killing connector %s on router %s" % (connector, router))
+        self.D_management_sender.send(msg)
         self.most_recent_kill = time.time()
 
-
-    def parse_link_query_response ( self, msg ) :
+    def parse_link_query_response(self, msg) :
         if msg.properties :
-           if "statusDescription" in msg.properties and "statusCode" in msg.properties :
-               if msg.properties["statusDescription"] == "No Content" and msg.properties["statusCode"] == 204 :
-                   self.debug_print ( "AD2_connector was killed" )
-                   self.confirmed_kill = True
+            if "statusDescription" in msg.properties and "statusCode" in msg.properties :
+                if msg.properties["statusDescription"] == "No Content" and msg.properties["statusCode"] == 204 :
+                    self.debug_print("AD2_connector was killed")
+                    self.confirmed_kill = True
 
-
-    #=======================================================
+    # =======================================================
     # Sender Side
-    #=======================================================
+    # =======================================================
 
-    def max_to_send ( self ) :
+    def max_to_send(self) :
         return self.n_messages + self.n_released
 
-
-    def send ( self ) :
+    def send(self) :
 
         if self.n_sent >= self.max_to_send() :
             return
 
-        for _ in range ( self.burst_size ) :
+        for _ in range(self.burst_size) :
             if self.sender.credit > 0 :
                 if self.n_sent < self.max_to_send() :
-                    msg = Message ( body=self.n_sent )
+                    msg = Message(body=self.n_sent)
                     self.n_sent += 1
-                    self.sender.send ( msg )
-                    self.debug_print ( "sent: %d" % self.n_sent )
+                    self.sender.send(msg)
+                    self.debug_print("sent: %d" % self.n_sent)
                 else :
                     pass
             else :
-                self.debug_print ( "sender has no credit." )
+                self.debug_print("sender has no credit.")
 
-
-    def on_accepted ( self, event ) :
+    def on_accepted(self, event) :
         if self.first_received is None :
             self.first_received = time.time()
-            if not self.first_released is None :
-                self.debug_print ( "Accepted first message. %d messages released in %.6lf seconds" % \
-                    ( self.n_released, self.first_received - self.first_released ) )
+            if self.first_released is not None :
+                self.debug_print("Accepted first message. %d messages released in %.6lf seconds" %
+                                 (self.n_released, self.first_received - self.first_released))
         self.n_accepted += 1
-        self.debug_print ( "on_accepted %d" % self.n_accepted )
-        self.bail_out_if_done ( )
+        self.debug_print("on_accepted %d" % self.n_accepted)
+        self.bail_out_if_done()
 
-
-    def on_released ( self, event ) :
+    def on_released(self, event) :
         if self.first_released is None :
             self.first_released = time.time()
         self.n_released += 1
-        self.receiver.flow ( 1 )
-        self.debug_print ( "on_released %d" % self.n_released )
-        self.bail_out_if_done ( )
+        self.receiver.flow(1)
+        self.debug_print("on_released %d" % self.n_released)
+        self.bail_out_if_done()
 
-
-    #=======================================================
+    # =======================================================
     # Receiver Side
-    #=======================================================
+    # =======================================================
 
-    def on_message ( self, event ):
+    def on_message(self, event):
         if event.receiver == self.D_management_receiver :
-            self.parse_link_query_response ( event.message )
+            self.parse_link_query_response(event.message)
         else :
             self.n_received += 1
-            self.debug_print ( "received message %s" % event.message.body )
-            self.debug_print ( "n_received == %d" % self.n_received )
+            self.debug_print("received message %s" % event.message.body)
+            self.debug_print("n_received == %d" % self.n_received)
             if self.n_received == 13 :
-                self.kill_the_connector ( )
+                self.kill_the_connector()
 
 
-class TopologyDisposition ( MessagingHandler ):
+class TopologyDisposition (MessagingHandler):
     """
     Test that disposition guarantee survives catastrophic
     damage to the router network.
@@ -796,8 +771,7 @@
     #     send timer because it seemed more realistic to me -- more like a real application --
     #     and that implies sending bursts of messages.
 
-
-    def __init__ ( self, test_name, client_addrs, destination ):
+    def __init__(self, test_name, client_addrs, destination):
         super(TopologyDisposition, self).__init__(prefetch=10)
         self.dest                 = destination
         self.error                = None
@@ -832,198 +806,189 @@
         # Holds the management sender, receiver, and 'helper'
         # associated with each router.
         self.routers = {
-                         'A' : dict(),
-                         'B' : dict(),
-                         'C' : dict(),
-                         'D' : dict()
-                       }
+            'A' : dict(),
+            'B' : dict(),
+            'C' : dict(),
+            'D' : dict()
+        }
 
         # This tells the system in what order to kill the connectors.
         self.kill_count = 0
         self.kill_list = (
-                           ( 'D', 'CD_connector' ),
-                           ( 'D', 'BD_connector' ),
-                           ( 'C', 'BC_connector' )
-                         )
+            ('D', 'CD_connector'),
+            ('D', 'BD_connector'),
+            ('C', 'BC_connector')
+        )
 
         # We use this to keep track of which connectors we have found
         # when the test is first getting started and we are checking
         # the topology.
-        self.connectors_map = { 'AB_connector' : 0,
-                                'AC_connector' : 0,
-                                'AD_connector' : 0,
-                                'BC_connector' : 0,
-                                'BD_connector' : 0,
-                                'CD_connector' : 0
-                              }
+        self.connectors_map = {'AB_connector' : 0,
+                               'AC_connector' : 0,
+                               'AD_connector' : 0,
+                               'BC_connector' : 0,
+                               'BD_connector' : 0,
+                               'CD_connector' : 0
+                               }
 
-
-    def state_transition ( self, message, new_state ) :
+    def state_transition(self, message, new_state) :
         if self.state == new_state :
             return
         self.state = new_state
-        self.debug_print ( "state transition to : %s -- because %s" % ( self.state, message ) )
+        self.debug_print("state transition to : %s -- because %s" % (self.state, message))
 
-
-    def debug_print ( self, text ) :
-        if self.debug == True:
-            print("%.6lf %s" % ( time.time(), text ))
-
+    def debug_print(self, text) :
+        if self.debug:
+            print("%.6lf %s" % (time.time(), text))
 
     # Shut down everything and exit.
-    def bail ( self, text ):
+    def bail(self, text):
         self.state = 'bailing'
-        self.test_timer.cancel ( )
-        self.send_timer.cancel ( )
+        self.test_timer.cancel()
+        self.send_timer.cancel()
 
         self.error = text
 
-        self.send_conn.close ( )
-        self.recv_conn.close ( )
+        self.send_conn.close()
+        self.recv_conn.close()
 
-        self.routers['A'] ['mgmt_conn'].close()
-        self.routers['B'] ['mgmt_conn'].close()
-        self.routers['C'] ['mgmt_conn'].close()
-        self.routers['D'] ['mgmt_conn'].close()
-
+        self.routers['A']['mgmt_conn'].close()
+        self.routers['B']['mgmt_conn'].close()
+        self.routers['C']['mgmt_conn'].close()
+        self.routers['D']['mgmt_conn'].close()
 
     # Two separate timers. One controls sending in bursts, one ends the test.
-    def timeout ( self, name ):
+    def timeout(self, name):
         if self.state == 'bailing' :
             return
 
         self.timeout_count += 1
         if name == 'test':
-            self.state_transition ( 'Timeout Expired', 'bailing' )
-            self.bail ( "Timeout Expired: n_sent=%d n_released=%d n_accepted=%d" % \
-                         ( self.n_sent, self.n_released, self.n_accepted ) )
+            self.state_transition('Timeout Expired', 'bailing')
+            self.bail("Timeout Expired: n_sent=%d n_released=%d n_accepted=%d" %
+                      (self.n_sent, self.n_released, self.n_accepted))
             return
         elif name == 'sender':
             if self.state == 'sending' :
                 if not (self.timeout_count % 20):
                     if self.kill_count < len(self.kill_list):
-                        self.kill_a_connector ( self.kill_list[self.kill_count] )
+                        self.kill_a_connector(self.kill_list[self.kill_count])
                         self.kill_count += 1
-                self.send ( )
+                self.send()
                 if self.n_sent >= self.to_be_sent :
-                    self.state_transition ( 'sent %d messages' % self.to_be_sent, 'done sending' )
+                    self.state_transition('sent %d messages' % self.to_be_sent, 'done sending')
             elif self.state == 'done sending' :
                 if self.n_sent == self.n_accepted + self.n_released :
-                    self.state_transition ( 'success', 'bailing' )
-                    self.bail ( None )
+                    self.state_transition('success', 'bailing')
+                    self.bail(None)
 
-            self.debug_print ( "sent: %d  received: %d accepted: %d   released: %d  confirmed kills: %d" % \
-                ( self.n_sent, self.n_received, self.n_accepted, self.n_released, self.confirmed_kills ) )
+            self.debug_print("sent: %d  received: %d accepted: %d   released: %d  confirmed kills: %d" %
+                             (self.n_sent, self.n_received, self.n_accepted, self.n_released, self.confirmed_kills))
 
             diff = self.n_sent - (self.n_accepted + self.n_released)
 
             # If the difference between n_sent and (accepted + released) is
             # ever greater than 10 (the send batch size)
             if diff >= self.send_burst_size and self.state == 'done sending' :
-                self.debug_print ( "TROUBLE : %d" % diff )
+                self.debug_print("TROUBLE : %d" % diff)
 
                 if self.first_trouble == 0:
                     self.first_trouble = time.time()
-                    self.debug_print ( "first trouble at %.6lf" % self.first_trouble )
+                    self.debug_print("first trouble at %.6lf" % self.first_trouble)
                 else:
                     trouble_duration = time.time() - self.first_trouble
-                    self.debug_print ( "trouble duration %.6lf" % trouble_duration )
+                    self.debug_print("trouble duration %.6lf" % trouble_duration)
                     if trouble_duration >= self.max_trouble_duration :
-                        self.state_transition ( 'trouble duration exceeded limit: %d' % self.max_trouble_duration, 'post mortem' )
-                        self.check_links ( )
+                        self.state_transition('trouble duration exceeded limit: %d' % self.max_trouble_duration, 'post mortem')
+                        self.check_links()
 
-            self.send_timer = self.reactor.schedule ( self.send_interval, Timeout(self, "sender") )
+            self.send_timer = self.reactor.schedule(self.send_interval, Timeout(self, "sender"))
 
-
-
-    def on_start ( self, event ):
-        self.state_transition ( 'on_start', 'starting' )
+    def on_start(self, event):
+        self.state_transition('on_start', 'starting')
         self.reactor = event.reactor
-        self.test_timer = event.reactor.schedule ( self.deadline, Timeout(self, "test") )
-        self.send_timer = event.reactor.schedule ( self.send_interval, Timeout(self, "sender") )
-        self.send_conn  = event.container.connect ( self.client_addrs['A'] )
-        self.recv_conn  = event.container.connect ( self.client_addrs['B'] )
+        self.test_timer = event.reactor.schedule(self.deadline, Timeout(self, "test"))
+        self.send_timer = event.reactor.schedule(self.send_interval, Timeout(self, "sender"))
+        self.send_conn  = event.container.connect(self.client_addrs['A'])
+        self.recv_conn  = event.container.connect(self.client_addrs['B'])
 
-        self.sender     = event.container.create_sender   ( self.send_conn, self.dest )
-        self.receiver   = event.container.create_receiver ( self.recv_conn, self.dest )
+        self.sender     = event.container.create_sender(self.send_conn, self.dest)
+        self.receiver   = event.container.create_receiver(self.recv_conn, self.dest)
 
-        self.routers['A'] ['mgmt_conn'] = event.container.connect ( self.client_addrs['A'] )
-        self.routers['B'] ['mgmt_conn'] = event.container.connect ( self.client_addrs['B'] )
-        self.routers['C'] ['mgmt_conn'] = event.container.connect ( self.client_addrs['C'] )
-        self.routers['D'] ['mgmt_conn'] = event.container.connect ( self.client_addrs['D'] )
+        self.routers['A']['mgmt_conn'] = event.container.connect(self.client_addrs['A'])
+        self.routers['B']['mgmt_conn'] = event.container.connect(self.client_addrs['B'])
+        self.routers['C']['mgmt_conn'] = event.container.connect(self.client_addrs['C'])
+        self.routers['D']['mgmt_conn'] = event.container.connect(self.client_addrs['D'])
 
-        self.routers['A'] ['mgmt_receiver'] = event.container.create_receiver ( self.routers['A'] ['mgmt_conn'], dynamic=True )
-        self.routers['B'] ['mgmt_receiver'] = event.container.create_receiver ( self.routers['B'] ['mgmt_conn'], dynamic=True )
-        self.routers['C'] ['mgmt_receiver'] = event.container.create_receiver ( self.routers['C'] ['mgmt_conn'], dynamic=True )
-        self.routers['D'] ['mgmt_receiver'] = event.container.create_receiver ( self.routers['D'] ['mgmt_conn'], dynamic=True )
+        self.routers['A']['mgmt_receiver'] = event.container.create_receiver(self.routers['A']['mgmt_conn'], dynamic=True)
+        self.routers['B']['mgmt_receiver'] = event.container.create_receiver(self.routers['B']['mgmt_conn'], dynamic=True)
+        self.routers['C']['mgmt_receiver'] = event.container.create_receiver(self.routers['C']['mgmt_conn'], dynamic=True)
+        self.routers['D']['mgmt_receiver'] = event.container.create_receiver(self.routers['D']['mgmt_conn'], dynamic=True)
 
-        self.routers['A'] ['mgmt_sender']   = event.container.create_sender   ( self.routers['A'] ['mgmt_conn'], "$management" )
-        self.routers['B'] ['mgmt_sender']   = event.container.create_sender   ( self.routers['B'] ['mgmt_conn'], "$management" )
-        self.routers['C'] ['mgmt_sender']   = event.container.create_sender   ( self.routers['C'] ['mgmt_conn'], "$management" )
-        self.routers['D'] ['mgmt_sender']   = event.container.create_sender   ( self.routers['D'] ['mgmt_conn'], "$management" )
+        self.routers['A']['mgmt_sender']   = event.container.create_sender(self.routers['A']['mgmt_conn'], "$management")
+        self.routers['B']['mgmt_sender']   = event.container.create_sender(self.routers['B']['mgmt_conn'], "$management")
+        self.routers['C']['mgmt_sender']   = event.container.create_sender(self.routers['C']['mgmt_conn'], "$management")
+        self.routers['D']['mgmt_sender']   = event.container.create_sender(self.routers['D']['mgmt_conn'], "$management")
 
-
-
-    #-----------------------------------------------------------------
+    # -----------------------------------------------------------------
     # At start-time, as the management links to the routers open,
     # check each one to make sure that it has all the expected
     # connections.
-    #-----------------------------------------------------------------
-    def on_link_opened ( self, event ) :
-        self.state_transition ( 'on_link_opened', 'topo checking' )
+    # -----------------------------------------------------------------
+
+    def on_link_opened(self, event) :
+        self.state_transition('on_link_opened', 'topo checking')
         # The A mgmt link has opened.  --------------------------
         # Give it some credit, but we don't need to use this one until
         # later, if there is a problem.
-        if event.receiver == self.routers['A'] ['mgmt_receiver'] :
-            event.receiver.flow ( self.flow )
-            self.routers['A'] ['mgmt_helper'] = ManagementMessageHelper ( event.receiver.remote_source.address )
+        if event.receiver == self.routers['A']['mgmt_receiver'] :
+            event.receiver.flow(self.flow)
+            self.routers['A']['mgmt_helper'] = ManagementMessageHelper(event.receiver.remote_source.address)
         # The B mgmt link has opened. Check its connections. --------------------------
-        elif event.receiver == self.routers['B'] ['mgmt_receiver'] :
-            event.receiver.flow ( self.flow )
-            self.routers['B'] ['mgmt_helper'] = ManagementMessageHelper ( event.receiver.remote_source.address )
-            for connector in [ 'AB_connector' ] :
-                self.connector_check ( 'B', connector )
+        elif event.receiver == self.routers['B']['mgmt_receiver'] :
+            event.receiver.flow(self.flow)
+            self.routers['B']['mgmt_helper'] = ManagementMessageHelper(event.receiver.remote_source.address)
+            for connector in ['AB_connector'] :
+                self.connector_check('B', connector)
         # The C mgmt link has opened. Check its connections. --------------------------
-        elif event.receiver == self.routers['C'] ['mgmt_receiver'] :
-            event.receiver.flow ( self.flow )
-            self.routers['C'] ['mgmt_helper'] = ManagementMessageHelper ( event.receiver.remote_source.address )
-            for connector in [ 'AC_connector', 'BC_connector' ] :
-                self.connector_check ( 'C', connector )
+        elif event.receiver == self.routers['C']['mgmt_receiver'] :
+            event.receiver.flow(self.flow)
+            self.routers['C']['mgmt_helper'] = ManagementMessageHelper(event.receiver.remote_source.address)
+            for connector in ['AC_connector', 'BC_connector'] :
+                self.connector_check('C', connector)
         # The D mgmt link has opened. Check its connections. --------------------------
-        elif event.receiver == self.routers['D'] ['mgmt_receiver']:
-            event.receiver.flow ( self.flow )
-            self.routers['D'] ['mgmt_helper'] = ManagementMessageHelper ( event.receiver.remote_source.address )
-            for connector in [ 'AD_connector', 'BD_connector', 'CD_connector' ] :
-                self.connector_check ( 'D', connector )
+        elif event.receiver == self.routers['D']['mgmt_receiver']:
+            event.receiver.flow(self.flow)
+            self.routers['D']['mgmt_helper'] = ManagementMessageHelper(event.receiver.remote_source.address)
+            for connector in ['AD_connector', 'BD_connector', 'CD_connector'] :
+                self.connector_check('D', connector)
 
-
-    def send ( self ):
+    def send(self):
         if self.state != 'sending' :
-            self.debug_print ( "send called while state is %s" % self.state )
+            self.debug_print("send called while state is %s" % self.state)
             return
 
-        for _ in range ( self.send_burst_size ) :
+        for _ in range(self.send_burst_size) :
             if self.sender.credit > 0 :
-                msg = Message ( body=self.n_sent )
-                msg_tag=str(self.n_sent)
-                dlv = self.sender.send ( msg, tag = msg_tag )
-                if dlv == None :
-                    self.debug_print ( "send failed" )
+                msg = Message(body=self.n_sent)
+                msg_tag = str(self.n_sent)
+                dlv = self.sender.send(msg, tag=msg_tag)
+                if dlv is None :
+                    self.debug_print("send failed")
                     return
-                self.message_status [ msg_tag ] = 'sent'
-                self.message_times  [ msg_tag ] = time.time()
+                self.message_status[msg_tag] = 'sent'
+                self.message_times[msg_tag] = time.time()
                 self.n_sent += 1
-        self.debug_print ( "send: n_sent %d credit is now: %d" % ( self.n_sent, self.sender.credit ) )
+        self.debug_print("send: n_sent %d credit is now: %d" % (self.n_sent, self.sender.credit))
 
-
-    def on_message ( self, event ):
-        #----------------------------------------------------------------
+    def on_message(self, event):
+        # ----------------------------------------------------------------
         # Is this a management message?
-        #----------------------------------------------------------------
-        if event.receiver == self.routers['A'] ['mgmt_receiver'] or \
-           event.receiver == self.routers['B'] ['mgmt_receiver'] or \
-           event.receiver == self.routers['C'] ['mgmt_receiver'] or \
-           event.receiver == self.routers['D'] ['mgmt_receiver'] :
+        # ----------------------------------------------------------------
+        if event.receiver == self.routers['A']['mgmt_receiver'] or \
+           event.receiver == self.routers['B']['mgmt_receiver'] or \
+           event.receiver == self.routers['C']['mgmt_receiver'] or \
+           event.receiver == self.routers['D']['mgmt_receiver'] :
 
             if self.state == 'topo checking' :
                 # In the 'topo checking' state, we send management messages to
@@ -1034,41 +999,41 @@
                     connection_name = event.message.body['name']
 
                     if connection_name in self.connectors_map :
-                        self.connectors_map [ connection_name ] = 1
-                        self.debug_print ( "topo check found connector %s" % connection_name )
+                        self.connectors_map[connection_name] = 1
+                        self.debug_print("topo check found connector %s" % connection_name)
                     else :
-                      self.bail ( "bad connection name: %s" % connection_name )
+                        self.bail("bad connection name: %s" % connection_name)
 
                     n_connections = sum(self.connectors_map.values())
                     if n_connections == 6 :
-                      self.state_transition ( 'topo check successful', 'link checking' )
-                      self.check_links ( )
+                        self.state_transition('topo check successful', 'link checking')
+                        self.check_links()
 
             elif self.state == 'link checking' or self.state == 'post mortem' :
                 # Link checking was used during initial debugging of this test,
                 # to visually check on the number of undelivered and unsettled
                 # messages in each link, especially during the "post mortem"
                 # state triggered by a failure.
-                if   event.receiver == self.routers['A'] ['mgmt_receiver'] :
-                    self.debug_print ( "received link check message from A ------------" )
-                elif event.receiver == self.routers['B'] ['mgmt_receiver'] :
-                    self.debug_print ( "received link check message from B ------------" )
-                elif event.receiver == self.routers['C'] ['mgmt_receiver'] :
-                    self.debug_print ( "received link check message from C ------------" )
-                elif event.receiver == self.routers['D'] ['mgmt_receiver'] :
-                    self.debug_print ( "received link check message from D ------------" )
+                if event.receiver == self.routers['A']['mgmt_receiver'] :
+                    self.debug_print("received link check message from A ------------")
+                elif event.receiver == self.routers['B']['mgmt_receiver'] :
+                    self.debug_print("received link check message from B ------------")
+                elif event.receiver == self.routers['C']['mgmt_receiver'] :
+                    self.debug_print("received link check message from C ------------")
+                elif event.receiver == self.routers['D']['mgmt_receiver'] :
+                    self.debug_print("received link check message from D ------------")
                 body = event.message.body
-                self.debug_print ( "body: %s" % body )
-                self.debug_print ( "properties: %s" % event.message.properties )
+                self.debug_print("body: %s" % body)
+                self.debug_print("properties: %s" % event.message.properties)
 
                 self.link_check_count -= 1
                 if self.link_check_count == 0 :
                     if self.state == 'link checking' :
-                        self.state_transition ( 'link check successful', 'sending' )
+                        self.state_transition('link check successful', 'sending')
                         self.send()
                     elif self.state == 'post mortem' :
-                        self.state_transition ( "post mortem complete", 'bailing' )
-                        self.bail ( "failed" )
+                        self.state_transition("post mortem complete", 'bailing')
+                        self.bail("failed")
             elif self.state == 'sending' :
                 if 'No Content' ==  event.message.properties['statusDescription']:
                     self.confirmed_kills += 1
@@ -1077,106 +1042,92 @@
             if event.receiver == self.receiver :
                 self.n_received += 1
 
-
-
-    def on_accepted ( self, event ):
+    def on_accepted(self, event):
         if event.sender == self.sender:
             self.n_accepted += 1
             tag = event.delivery.tag
-            self.message_status [ tag ] = 'accepted'
+            self.message_status[tag] = 'accepted'
 
-
-    def on_released ( self, event ) :
+    def on_released(self, event) :
 
         if event.sender == self.sender:
             self.n_released += 1
             tag = event.delivery.tag
-            self.message_status [ tag ] = 'released'
+            self.message_status[tag] = 'released'
 
+    def connector_check(self, router, connector) :
+        self.debug_print("checking connector %s for router %s" % (connector, router))
+        mgmt_helper = self.routers[router]['mgmt_helper']
+        mgmt_sender = self.routers[router]['mgmt_sender']
+        msg = mgmt_helper.make_connector_query(connector)
+        mgmt_sender.send(msg)
 
-    def connector_check ( self, router, connector ) :
-        self.debug_print ( "checking connector %s for router %s" % (connector, router) )
-        mgmt_helper = self.routers[router] ['mgmt_helper']
-        mgmt_sender = self.routers[router] ['mgmt_sender']
-        msg = mgmt_helper.make_connector_query ( connector )
-        mgmt_sender.send ( msg )
-
-
-    def check_links ( self ) :
+    def check_links(self) :
         self.link_check_count = 4
-        self.link_check ( 'A' )
-        self.link_check ( 'B' )
-        self.link_check ( 'C' )
-        self.link_check ( 'D' )
+        self.link_check('A')
+        self.link_check('B')
+        self.link_check('C')
+        self.link_check('D')
 
-
-    def link_check ( self, router_name ) :
-        mgmt_helper = self.routers[router_name] ['mgmt_helper']
-        mgmt_sender = self.routers[router_name] ['mgmt_sender']
-        msg = mgmt_helper.make_router_link_query ( )
-        mgmt_sender.send ( msg )
-
+    def link_check(self, router_name) :
+        mgmt_helper = self.routers[router_name]['mgmt_helper']
+        mgmt_sender = self.routers[router_name]['mgmt_sender']
+        msg = mgmt_helper.make_router_link_query()
+        mgmt_sender.send(msg)
 
     # The target structure provides the name of the router and the name of its connector
     # that is to be killed. Create the appropriate management message, and send it off.
-    def kill_a_connector ( self, target ) :
+    def kill_a_connector(self, target) :
         router = target[0]
         connector = target[1]
-        mgmt_helper = self.routers[router] ['mgmt_helper']
-        mgmt_sender = self.routers[router] ['mgmt_sender']
-        msg = mgmt_helper.make_connector_delete_command ( connector )
-        self.debug_print ( "killing connector %s on router %s" % (connector, router) )
-        mgmt_sender.send ( msg )
+        mgmt_helper = self.routers[router]['mgmt_helper']
+        mgmt_sender = self.routers[router]['mgmt_sender']
+        msg = mgmt_helper.make_connector_delete_command(connector)
+        self.debug_print("killing connector %s on router %s" % (connector, router))
+        mgmt_sender.send(msg)
         self.most_recent_kill = time.time()
 
+    # Used during debugging.
+    def print_message_status(self) :
+        for i in range(self.n_sent) :
+            tag = str(i)
+            print("%s %s" % (tag, self.message_status[tag]))
 
     # Used during debugging.
-    def print_message_status ( self ) :
-        for i in range ( self.n_sent ) :
-            tag = str ( i )
-            print("%s %s" % (tag, self.message_status [ tag ]))
-
-
-    # Used during debugging.
-    def print_unknown_messages ( self ) :
+    def print_unknown_messages(self) :
         count = 0
         print("Messages with unknown status: ")
-        for i in range ( self.n_sent ) :
-            tag = str ( i )
-            if self.message_status [ tag ] == 'sent' :
-              count = count + 1
-              print('    %s sent: %s' % (tag, self.message_times [ tag ]))
+        for i in range(self.n_sent) :
+            tag = str(i)
+            if self.message_status[tag] == 'sent' :
+                count = count + 1
+                print('    %s sent: %s' % (tag, self.message_times[tag]))
         print("    total: %s" % count)
 
-
     # Used during debugging.
-    def quick_print_unknown_messages ( self ) :
+    def quick_print_unknown_messages(self) :
         count = 0
         print("Messages with unknown status: ")
 
         first = -1
         last  =  0
 
-        for i in range ( self.n_sent ) :
-            tag = str ( i )
-            if self.message_status [ tag ] == 'sent' : # It's not accepted or released.
-              count = count + 1
-              if first == -1 :
-                first = i
-              if i > last :
-                last = i
+        for i in range(self.n_sent) :
+            tag = str(i)
+            if self.message_status[tag] == 'sent' :  # It's not accepted or released.
+                count = count + 1
+                if first == -1 :
+                    first = i
+                if i > last :
+                    last = i
 
         print('    first : %s sent : %.6lf' % (first, self.message_times[str(first)]))
         print('    last  : %s sent : %.6lf' % (last, self.message_times[str(last)]))
         print("    total : %s" % count)
 
-
     def run(self):
         Container(self).run()
 
 
-
-
-
 if __name__ == '__main__':
     unittest.main(main_module())
diff --git a/tests/system_tests_two_routers.py b/tests/system_tests_two_routers.py
index d2c90f9..9ca4c3d 100644
--- a/tests/system_tests_two_routers.py
+++ b/tests/system_tests_two_routers.py
@@ -23,7 +23,8 @@
 from __future__ import print_function
 
 from time import sleep
-import json, os
+import json
+import os
 import logging
 from threading import Timer
 from subprocess import PIPE, STDOUT
@@ -41,6 +42,7 @@
 from qpid_dispatch.management.client import Node
 CONNECTION_PROPERTIES_UNICODE_STRING = {u'connection': u'properties', u'int_property': 6451}
 
+
 class TwoRouterTest(TestCase):
 
     inter_router_port = None
@@ -57,7 +59,7 @@
                 # Use the deprecated attributes helloInterval, raInterval, raIntervalFlux, remoteLsMaxAge
                 # The routers should still start successfully after using these deprecated entities.
                 ('router', {'remoteLsMaxAge': 60, 'helloInterval': 1, 'raInterval': 30, 'raIntervalFlux': 4,
-                            'mode': 'interior', 'id': 'QDR.%s'%name, 'allowUnsettledMulticast': 'yes'}),
+                            'mode': 'interior', 'id': 'QDR.%s' % name, 'allowUnsettledMulticast': 'yes'}),
                 ('listener', {'port': cls.tester.get_port(), 'stripAnnotations': 'no', 'linkCapacity': 500}),
 
                 ('listener', {'port': cls.tester.get_port(), 'stripAnnotations': 'no'}),
@@ -231,14 +233,14 @@
         # verify proper distribution is selected by wildcard
         addresses = [
             # (address, count of messages expected to be received)
-            ('a.b.c.d',   1), # closest 'a.b.c.d'
-            ('b.c.d',     2), # multi   '#.b.c.d'
-            ('f.a.b.c.d', 2), # multi   '#.b.c.d
-            ('a.c.d',     2), # multi   'a.*.d'
-            ('a/c/c/d',   1), # closest 'a/*/#.d
-            ('a/x/z/z/d', 1), # closest 'a/*/#.d
-            ('a/x/d',     1), # closest 'a.x.d'
-            ('a.x.e',     1), # balanced  ----
+            ('a.b.c.d',   1),  # closest 'a.b.c.d'
+            ('b.c.d',     2),  # multi   '#.b.c.d'
+            ('f.a.b.c.d', 2),  # multi   '#.b.c.d
+            ('a.c.d',     2),  # multi   'a.*.d'
+            ('a/c/c/d',   1),  # closest 'a/*/#.d
+            ('a/x/z/z/d', 1),  # closest 'a/*/#.d
+            ('a/x/d',     1),  # closest 'a.x.d'
+            ('a.x.e',     1),  # balanced  ----
             ('m.b.c.d',   2)  # multi   '*/b/c/d'
         ]
 
@@ -333,7 +335,7 @@
         identity = None
         passed = False
 
-        print ()
+        print()
 
         for output in outputs:
             if output.get('properties'):
@@ -391,7 +393,7 @@
                 rx.queue.get(timeout=TIMEOUT)
                 i -= 1
             except AsyncTestReceiver.Empty:
-                break;
+                break
         self.assertEqual(0, i)
         rx.stop()
 
@@ -409,7 +411,6 @@
         self.success = False
         self.error = None
 
-
     def on_start(self, event):
         self.timer = event.reactor.schedule(TIMEOUT, TestTimeout(self))
 
@@ -421,11 +422,12 @@
         self.mgmt_sender = event.container.create_sender(self.mgmt_conn)
         self.mgmt_receiver = event.container.create_receiver(self.mgmt_conn, None, dynamic=True)
         self.mgmt_receiver_1 = event.container.create_receiver(self.mgmt_conn,
-                                                             None,
-                                                             dynamic=True)
+                                                               None,
+                                                               dynamic=True)
         self.mgmt_receiver_2 = event.container.create_receiver(self.mgmt_conn,
-                                                             None,
-                                                             dynamic=True)
+                                                               None,
+                                                               dynamic=True)
+
     def timeout(self):
         self.error = "Timeout Expired: sent=%d, received=%d" % (self.n_sent, self.n_received)
         self.mgmt_conn.close()
@@ -466,7 +468,7 @@
                                 u'operation': u'UPDATE'
                             }
                             request.body = {
-                                u'adminStatus':  u'deleted'}
+                                u'adminStatus': u'deleted'}
                             request.reply_to = self.mgmt_receiver_1.remote_source.address
                             self.mgmt_sender.send(request)
         elif event.receiver == self.mgmt_receiver_1:
@@ -656,6 +658,7 @@
 
 class AttachOnInterRouterTest(MessagingHandler):
     """Expect an error when attaching a link to an inter-router listener"""
+
     def __init__(self, address):
         super(AttachOnInterRouterTest, self).__init__(prefetch=0)
         self.address = address
@@ -679,11 +682,11 @@
         self.timer.cancel()
 
     def run(self):
-        logging.disable(logging.ERROR) # Hide expected log errors
+        logging.disable(logging.ERROR)  # Hide expected log errors
         try:
             Container(self).run()
         finally:
-            logging.disable(logging.NOTSET) # Restore to normal
+            logging.disable(logging.NOTSET)  # Restore to normal
 
 
 class DeliveriesInTransit(MessagingHandler):
@@ -716,7 +719,7 @@
         self.receiver = event.container.create_receiver(self.conn2, self.dest)
 
     def on_sendable(self, event):
-        if self.n_sent <= self.num_msgs-1:
+        if self.n_sent <= self.num_msgs - 1:
             msg = Message(body="Hello World")
             self.sender.send(msg)
             self.n_sent += 1
@@ -729,7 +732,7 @@
             self.conn2.close()
 
     def on_message(self, event):
-        self.received_count+=1
+        self.received_count += 1
         self.check_if_done()
 
     def run(self):
@@ -1184,7 +1187,6 @@
         Container(self).run()
 
 
-
 class SenderSettlesFirst(MessagingHandler):
     def __init__(self, address1, address2):
         super(SenderSettlesFirst, self).__init__(auto_accept=False)
@@ -1547,6 +1549,7 @@
     """
     Verify outcomes are properly sent end-to-end
     """
+
     def __init__(self, test, address1, address2):
         super(PropagatedDisposition, self).__init__(auto_accept=False)
         self.address1 = address1
@@ -1642,6 +1645,7 @@
     Verify that data associated with a terminal outcome is correctly passed end
     to end
     """
+
     def set_rejected_data(self, local_state):
         local_state.condition = Condition("name",
                                           str("description"),
@@ -1740,22 +1744,22 @@
         cls.B_normal_port_2 = cls.tester.get_port()
 
         TwoRouterConnection.router('A', [
-                        ('router', {'mode': 'interior', 'id': 'A'}),
-                        ('listener', {'host': '0.0.0.0', 'role': 'normal',
-                                      'port': cls.tester.get_port()}),
-                        ]
-              )
+            ('router', {'mode': 'interior', 'id': 'A'}),
+            ('listener', {'host': '0.0.0.0', 'role': 'normal',
+                          'port': cls.tester.get_port()}),
+        ]
+        )
 
         TwoRouterConnection.router('B',
-                    [
-                        ('router', {'mode': 'interior', 'id': 'B'}),
-                        ('listener', {'host': '0.0.0.0', 'role': 'normal',
-                                      'port': cls.B_normal_port_1}),
-                        ('listener', {'host': '0.0.0.0', 'role': 'normal',
-                                      'port': cls.B_normal_port_2}),
+                                   [
+                                       ('router', {'mode': 'interior', 'id': 'B'}),
+                                       ('listener', {'host': '0.0.0.0', 'role': 'normal',
+                                                     'port': cls.B_normal_port_1}),
+                                       ('listener', {'host': '0.0.0.0', 'role': 'normal',
+                                                     'port': cls.B_normal_port_2}),
 
-                    ]
-               )
+                                   ]
+                                   )
 
     def address(self):
         return self.routers[0].addresses[0]
@@ -1828,6 +1832,7 @@
 
         self.assertTrue(self.success)
 
+
 class PropagationTest(TestCase):
 
     inter_router_port = None
@@ -1840,7 +1845,7 @@
         def router(name, extra_config):
 
             config = [
-                ('router', {'mode': 'interior', 'id': 'QDR.%s'%name}),
+                ('router', {'mode': 'interior', 'id': 'QDR.%s' % name}),
 
                 ('listener', {'port': cls.tester.get_port()}),
 
@@ -1865,6 +1870,7 @@
         self.assertEqual(None, test.error)
         self.assertEqual(test.received, 2)
 
+
 class CreateReceiver(MessagingHandler):
     def __init__(self, connection, address):
         super(CreateReceiver, self).__init__()
@@ -1874,6 +1880,7 @@
     def on_timer_task(self, event):
         event.container.create_receiver(self.connection, self.address)
 
+
 class DelayedSend(MessagingHandler):
     def __init__(self, connection, address, message):
         super(DelayedSend, self).__init__()
@@ -1884,6 +1891,7 @@
     def on_timer_task(self, event):
         event.container.create_sender(self.connection, self.address).send(self.message)
 
+
 class MulticastTestClient(MessagingHandler):
     def __init__(self, router1, router2):
         super(MulticastTestClient, self).__init__()
@@ -1992,7 +2000,7 @@
                "-t", address,
                "-c", "1",
                "-sx"
-        ]
+               ]
         senders = [self.popen(cmd, env=env) for x in range(sender_count)]
 
         for tx in senders:
@@ -2032,7 +2040,7 @@
                 ('router', {'mode': 'interior',
                             'id': name}),
 
-                ('listener', {'port': cls.tester.get_port() }),
+                ('listener', {'port': cls.tester.get_port()}),
 
                 ('address', {'prefix': 'closest', 'distribution': 'closest'}),
                 ('address', {'prefix': 'balanced', 'distribution': 'balanced'}),
@@ -2074,7 +2082,6 @@
                                                 'direction': 'out'}),
                              ])
 
-
         cls.RouterA.wait_router_connected('RouterB')
         cls.RouterB.wait_router_connected('RouterA')
 
@@ -2087,17 +2094,17 @@
             This service saves any outcome and extension data that arrives in a
             transfer
             """
+
             def __init__(self, url, container_id=None):
                 self.remote_state = None
                 self.remote_data = None
                 super(MyExtendedService, self).__init__(url, container_id)
 
             def on_message(self, event):
-                self.remote_state = event.delivery.remote_state;
-                self.remote_data = event.delivery.remote.data;
+                self.remote_state = event.delivery.remote_state
+                self.remote_data = event.delivery.remote.data
                 super(MyExtendedService, self).on_message(event)
 
-
         fs = MyExtendedService(self.RouterB.addresses[1],
                                container_id="FakeService")
         self.RouterA.wait_address("RoutieMcRouteFace", remotes=1, count=2)
@@ -2154,6 +2161,7 @@
     This sender sets a non-terminal outcome and data on the outgoing
     transfer
     """
+
     def on_sendable(self, event):
         if self.sent < self.total:
             dlv = event.sender.delivery(str(self.sent))
@@ -2169,6 +2177,7 @@
     This receiver stores any remote delivery state that arrives with a message
     transfer
     """
+
     def __init__(self, *args, **kwargs):
         self.remote_states = []
         super(MyExtendedReceiver, self).__init__(*args, **kwargs)
@@ -2194,6 +2203,7 @@
     extension state data.  The sender expects to find this new state associated
     with its delivery.
     """
+
     def __init__(self, ingress_router, egress_router, address):
         super(ExtensionStateTester, self).__init__(auto_settle=False,
                                                    auto_accept=False)
@@ -2221,6 +2231,7 @@
         self._receiver = event.container.create_receiver(self._recvr_conn,
                                                          source=self._address,
                                                          name="ExtensionReceiver")
+
     def _done(self, error=None):
         self.error = error or self.error
         self._sender.close()
diff --git a/tests/system_tests_user_id.py b/tests/system_tests_user_id.py
index 75ba6ed..7fe6bba 100644
--- a/tests/system_tests_user_id.py
+++ b/tests/system_tests_user_id.py
@@ -28,6 +28,7 @@
 from qpid_dispatch.management.client import Node
 from proton import SSLDomain
 
+
 class QdSSLUseridTest(TestCase):
 
     @staticmethod
@@ -48,107 +49,107 @@
 
             # sha1
             ('sslProfile', {'name': 'server-ssl1',
-                             'caCertFile': cls.ssl_file('ca-certificate.pem'),
-                             'certFile': cls.ssl_file('server-certificate.pem'),
-                             'privateKeyFile': cls.ssl_file('server-private-key.pem'),
-                             'uidFormat': '1',
-                             'password': 'server-password'}),
+                            'caCertFile': cls.ssl_file('ca-certificate.pem'),
+                            'certFile': cls.ssl_file('server-certificate.pem'),
+                            'privateKeyFile': cls.ssl_file('server-private-key.pem'),
+                            'uidFormat': '1',
+                            'password': 'server-password'}),
 
             # sha256
             ('sslProfile', {'name': 'server-ssl2',
-                             'caCertFile': cls.ssl_file('ca-certificate.pem'),
-                             'certFile': cls.ssl_file('server-certificate.pem'),
-                             'privateKeyFile': cls.ssl_file('server-private-key.pem'),
-                             'uidFormat': '2',
-                             'password': 'server-password'}),
+                            'caCertFile': cls.ssl_file('ca-certificate.pem'),
+                            'certFile': cls.ssl_file('server-certificate.pem'),
+                            'privateKeyFile': cls.ssl_file('server-private-key.pem'),
+                            'uidFormat': '2',
+                            'password': 'server-password'}),
 
             # sha512
             ('sslProfile', {'name': 'server-ssl3',
-                             'caCertFile': cls.ssl_file('ca-certificate.pem'),
-                             'certFile': cls.ssl_file('server-certificate.pem'),
-                             'privateKeyFile': cls.ssl_file('server-private-key.pem'),
-                             'uidFormat': '5',
-                             'password': 'server-password'}),
+                            'caCertFile': cls.ssl_file('ca-certificate.pem'),
+                            'certFile': cls.ssl_file('server-certificate.pem'),
+                            'privateKeyFile': cls.ssl_file('server-private-key.pem'),
+                            'uidFormat': '5',
+                            'password': 'server-password'}),
 
             # sha256 combination
             ('sslProfile', {'name': 'server-ssl4',
-                             'caCertFile': cls.ssl_file('ca-certificate.pem'),
-                             'certFile': cls.ssl_file('server-certificate.pem'),
-                             'privateKeyFile': cls.ssl_file('server-private-key.pem'),
-                             'uidFormat': '2noucs',
-                             'password': 'server-password'}),
+                            'caCertFile': cls.ssl_file('ca-certificate.pem'),
+                            'certFile': cls.ssl_file('server-certificate.pem'),
+                            'privateKeyFile': cls.ssl_file('server-private-key.pem'),
+                            'uidFormat': '2noucs',
+                            'password': 'server-password'}),
 
             # sha1 combination
             ('sslProfile', {'name': 'server-ssl5',
-                             'caCertFile': cls.ssl_file('ca-certificate.pem'),
-                             'certFile': cls.ssl_file('server-certificate.pem'),
-                             'privateKeyFile': cls.ssl_file('server-private-key.pem'),
-                             'uidFormat': '1cs',
-                             'password': 'server-password'}),
+                            'caCertFile': cls.ssl_file('ca-certificate.pem'),
+                            'certFile': cls.ssl_file('server-certificate.pem'),
+                            'privateKeyFile': cls.ssl_file('server-private-key.pem'),
+                            'uidFormat': '1cs',
+                            'password': 'server-password'}),
 
             # sha512 combination
             ('sslProfile', {'name': 'server-ssl6',
-                             'caCertFile': cls.ssl_file('ca-certificate.pem'),
-                             'certFile': cls.ssl_file('server-certificate.pem'),
-                             'privateKeyFile': cls.ssl_file('server-private-key.pem'),
-                             'uidFormat': 'cs5',
+                            'caCertFile': cls.ssl_file('ca-certificate.pem'),
+                            'certFile': cls.ssl_file('server-certificate.pem'),
+                            'privateKeyFile': cls.ssl_file('server-private-key.pem'),
+                            'uidFormat': 'cs5',
                             # Use the env: prefix TLS_SERVER_PASSWORD. The TLS_SERVER_PASSWORD
                             # is set to 'server-password'
-                             'password': 'env:TLS_SERVER_PASSWORD'}),
+                            'password': 'env:TLS_SERVER_PASSWORD'}),
 
             # no fingerprint field
             ('sslProfile', {'name': 'server-ssl7',
-                             'caCertFile': cls.ssl_file('ca-certificate.pem'),
-                             'certFile': cls.ssl_file('server-certificate.pem'),
-                             'privateKeyFile': cls.ssl_file('server-private-key.pem'),
-                             'uidFormat': 'nsuco',
-                             'password': 'server-password'}),
+                            'caCertFile': cls.ssl_file('ca-certificate.pem'),
+                            'certFile': cls.ssl_file('server-certificate.pem'),
+                            'privateKeyFile': cls.ssl_file('server-private-key.pem'),
+                            'uidFormat': 'nsuco',
+                            'password': 'server-password'}),
 
             # no fingerprint field variation
             ('sslProfile', {'name': 'server-ssl8',
-                             'caCertFile': cls.ssl_file('ca-certificate.pem'),
-                             'certFile': cls.ssl_file('server-certificate.pem'),
-                             'privateKeyFile': cls.ssl_file('server-private-key.pem'),
-                             'uidFormat': 'scounl',
-                             'password': 'server-password'}),
+                            'caCertFile': cls.ssl_file('ca-certificate.pem'),
+                            'certFile': cls.ssl_file('server-certificate.pem'),
+                            'privateKeyFile': cls.ssl_file('server-private-key.pem'),
+                            'uidFormat': 'scounl',
+                            'password': 'server-password'}),
 
-            #no uidFormat
+            # no uidFormat
             ('sslProfile', {'name': 'server-ssl9',
-                             'caCertFile': cls.ssl_file('ca-certificate.pem'),
-                             'certFile': cls.ssl_file('server-certificate.pem'),
-                             'privateKeyFile': cls.ssl_file('server-private-key.pem'),
+                            'caCertFile': cls.ssl_file('ca-certificate.pem'),
+                            'certFile': cls.ssl_file('server-certificate.pem'),
+                            'privateKeyFile': cls.ssl_file('server-private-key.pem'),
                             # Use the prefix 'file:' for the password. This should read the file and
                             # use the password from the file.
-                             'password': 'file:' + cls.ssl_file('server-password-file.txt')}),
+                            'password': 'file:' + cls.ssl_file('server-password-file.txt')}),
 
             # one component of uidFormat is invalid (x), this will result in an error in the fingerprint calculation.
             # The user_id will fall back to proton's pn_transport_get_user
             ('sslProfile', {'name': 'server-ssl10',
-                             'caCertFile': cls.ssl_file('ca-certificate.pem'),
-                             'certFile': cls.ssl_file('server-certificate.pem'),
-                             'privateKeyFile': cls.ssl_file('server-private-key.pem'),
-                             'uidFormat': '1x',
-                             'uidNameMappingFile': ssl_profile2_json,
-                             'password': 'server-password'}),
+                            'caCertFile': cls.ssl_file('ca-certificate.pem'),
+                            'certFile': cls.ssl_file('server-certificate.pem'),
+                            'privateKeyFile': cls.ssl_file('server-private-key.pem'),
+                            'uidFormat': '1x',
+                            'uidNameMappingFile': ssl_profile2_json,
+                            'password': 'server-password'}),
 
             # All components in the uidFormat are unrecognized, pn_get_transport_user will be returned
             ('sslProfile', {'name': 'server-ssl11',
-                             'caCertFile': cls.ssl_file('ca-certificate.pem'),
-                             'certFile': cls.ssl_file('server-certificate.pem'),
-                             'privateKeyFile': cls.ssl_file('server-private-key.pem'),
-                             'uidFormat': 'abxd',
+                            'caCertFile': cls.ssl_file('ca-certificate.pem'),
+                            'certFile': cls.ssl_file('server-certificate.pem'),
+                            'privateKeyFile': cls.ssl_file('server-private-key.pem'),
+                            'uidFormat': 'abxd',
                             # Use the prefix 'literal:'. This makes sure we maintain
-                            #backward compatability
-                             'password': 'literal:server-password'}),
+                            # backward compatability
+                            'password': 'literal:server-password'}),
 
             ('sslProfile', {'name': 'server-ssl12',
-                             'caCertFile': cls.ssl_file('ca-certificate.pem'),
-                             'certFile': cls.ssl_file('server-certificate.pem'),
-                             'privateKeyFile': cls.ssl_file('server-private-key.pem'),
-                             'uidFormat': '1',
-                             'uidNameMappingFile': ssl_profile1_json,
+                            'caCertFile': cls.ssl_file('ca-certificate.pem'),
+                            'certFile': cls.ssl_file('server-certificate.pem'),
+                            'privateKeyFile': cls.ssl_file('server-private-key.pem'),
+                            'uidFormat': '1',
+                            'uidNameMappingFile': ssl_profile1_json,
                             # Use the pass: followed by the actual password
-                             'password': 'pass:server-password'}),
+                            'password': 'pass:server-password'}),
 
             # should translate a display name
             # specifying both passwordFile and password, password takes precedence.
@@ -232,9 +233,9 @@
             @param opts: Parsed optoins including connection_options()
         """
         certificate, key, trustfile, password = ssl_options_dict.get('ssl-certificate'), \
-                                                ssl_options_dict.get('ssl-key'), \
-                                                ssl_options_dict.get('ssl-trustfile'), \
-                                                ssl_options_dict.get('ssl-password')
+            ssl_options_dict.get('ssl-key'), \
+            ssl_options_dict.get('ssl-trustfile'), \
+            ssl_options_dict.get('ssl-password')
 
         if not (certificate or trustfile):
             return None
@@ -281,32 +282,32 @@
         addr = self.address(4).replace("amqp", "amqps")
         node = Node.connect(addr, ssl_domain=domain)
         self.assertEqual("3eccbf1a2f3e46da823c63a9da9158983cb495a3;US;NC",
-        node.query(type='org.apache.qpid.dispatch.connection', attribute_names=[u'user']).results[4][0])
+                         node.query(type='org.apache.qpid.dispatch.connection', attribute_names=[u'user']).results[4][0])
 
         addr = self.address(5).replace("amqp", "amqps")
         node = Node.connect(addr, ssl_domain=domain)
         self.assertEqual("US;NC;c6de3a340014b0f8a1d2b41d22e414fc5756494ffa3c8760bbff56f3aa9f179a5a6eae09413fd7a6afbf36b5fb4bad8795c2836774acfe00a701797cc2a3a9ab",
-        node.query(type='org.apache.qpid.dispatch.connection', attribute_names=[u'user']).results[5][0])
+                         node.query(type='org.apache.qpid.dispatch.connection', attribute_names=[u'user']).results[5][0])
 
         addr = self.address(6).replace("amqp", "amqps")
         node = Node.connect(addr, ssl_domain=domain)
         self.assertEqual("127.0.0.1;NC;Dev;US;Client",
-        node.query(type='org.apache.qpid.dispatch.connection', attribute_names=[u'user']).results[6][0])
+                         node.query(type='org.apache.qpid.dispatch.connection', attribute_names=[u'user']).results[6][0])
 
         addr = self.address(7).replace("amqp", "amqps")
         node = Node.connect(addr, ssl_domain=domain)
         self.assertEqual("NC;US;Client;Dev;127.0.0.1;Raleigh",
-        node.query(type='org.apache.qpid.dispatch.connection', attribute_names=[u'user']).results[7][0])
+                         node.query(type='org.apache.qpid.dispatch.connection', attribute_names=[u'user']).results[7][0])
 
         addr = self.address(8).replace("amqp", "amqps")
         node = Node.connect(addr, ssl_domain=domain)
         self.assertEqual("C=US,ST=NC,L=Raleigh,OU=Dev,O=Client,CN=127.0.0.1",
-        node.query(type='org.apache.qpid.dispatch.connection', attribute_names=[u'user']).results[8][0])
+                         node.query(type='org.apache.qpid.dispatch.connection', attribute_names=[u'user']).results[8][0])
 
         addr = self.address(9).replace("amqp", "amqps")
         node = Node.connect(addr, ssl_domain=domain)
         self.assertEqual("C=US,ST=NC,L=Raleigh,OU=Dev,O=Client,CN=127.0.0.1",
-        node.query(type='org.apache.qpid.dispatch.connection', attribute_names=[u'user']).results[9][0])
+                         node.query(type='org.apache.qpid.dispatch.connection', attribute_names=[u'user']).results[9][0])
 
         addr = self.address(10).replace("amqp", "amqps")
         node = Node.connect(addr, ssl_domain=domain)
diff --git a/tests/system_tests_user_id_proxy.py b/tests/system_tests_user_id_proxy.py
index 360ad09..2e936ce 100644
--- a/tests/system_tests_user_id_proxy.py
+++ b/tests/system_tests_user_id_proxy.py
@@ -52,100 +52,100 @@
 
             # sha1
             ('sslProfile', {'name': 'server-ssl1',
-                             'caCertFile': cls.ssl_file('ca-certificate.pem'),
-                             'certFile': cls.ssl_file('server-certificate.pem'),
-                             'privateKeyFile': cls.ssl_file('server-private-key.pem'),
-                             'uidFormat': '1',
-                             'password': 'server-password'}),
+                            'caCertFile': cls.ssl_file('ca-certificate.pem'),
+                            'certFile': cls.ssl_file('server-certificate.pem'),
+                            'privateKeyFile': cls.ssl_file('server-private-key.pem'),
+                            'uidFormat': '1',
+                            'password': 'server-password'}),
 
             # sha256
             ('sslProfile', {'name': 'server-ssl2',
-                             'caCertFile': cls.ssl_file('ca-certificate.pem'),
-                             'certFile': cls.ssl_file('server-certificate.pem'),
-                             'privateKeyFile': cls.ssl_file('server-private-key.pem'),
-                             'uidFormat': '2',
-                             'password': 'server-password'}),
+                            'caCertFile': cls.ssl_file('ca-certificate.pem'),
+                            'certFile': cls.ssl_file('server-certificate.pem'),
+                            'privateKeyFile': cls.ssl_file('server-private-key.pem'),
+                            'uidFormat': '2',
+                            'password': 'server-password'}),
 
             # sha512
             ('sslProfile', {'name': 'server-ssl3',
-                             'caCertFile': cls.ssl_file('ca-certificate.pem'),
-                             'certFile': cls.ssl_file('server-certificate.pem'),
-                             'privateKeyFile': cls.ssl_file('server-private-key.pem'),
-                             'uidFormat': '5',
-                             'password': 'server-password'}),
+                            'caCertFile': cls.ssl_file('ca-certificate.pem'),
+                            'certFile': cls.ssl_file('server-certificate.pem'),
+                            'privateKeyFile': cls.ssl_file('server-private-key.pem'),
+                            'uidFormat': '5',
+                            'password': 'server-password'}),
 
             # sha256 combination
             ('sslProfile', {'name': 'server-ssl4',
-                             'caCertFile': cls.ssl_file('ca-certificate.pem'),
-                             'certFile': cls.ssl_file('server-certificate.pem'),
-                             'privateKeyFile': cls.ssl_file('server-private-key.pem'),
-                             'uidFormat': '2noucs',
-                             'password': 'server-password'}),
+                            'caCertFile': cls.ssl_file('ca-certificate.pem'),
+                            'certFile': cls.ssl_file('server-certificate.pem'),
+                            'privateKeyFile': cls.ssl_file('server-private-key.pem'),
+                            'uidFormat': '2noucs',
+                            'password': 'server-password'}),
 
             # sha1 combination
             ('sslProfile', {'name': 'server-ssl5',
-                             'caCertFile': cls.ssl_file('ca-certificate.pem'),
-                             'certFile': cls.ssl_file('server-certificate.pem'),
-                             'privateKeyFile': cls.ssl_file('server-private-key.pem'),
-                             'uidFormat': '1cs',
-                             'password': 'server-password'}),
+                            'caCertFile': cls.ssl_file('ca-certificate.pem'),
+                            'certFile': cls.ssl_file('server-certificate.pem'),
+                            'privateKeyFile': cls.ssl_file('server-private-key.pem'),
+                            'uidFormat': '1cs',
+                            'password': 'server-password'}),
 
             # sha512 combination
             ('sslProfile', {'name': 'server-ssl6',
-                             'caCertFile': cls.ssl_file('ca-certificate.pem'),
-                             'certFile': cls.ssl_file('server-certificate.pem'),
-                             'privateKeyFile': cls.ssl_file('server-private-key.pem'),
-                             'uidFormat': 'cs5',
-                             'password': 'server-password'}),
+                            'caCertFile': cls.ssl_file('ca-certificate.pem'),
+                            'certFile': cls.ssl_file('server-certificate.pem'),
+                            'privateKeyFile': cls.ssl_file('server-private-key.pem'),
+                            'uidFormat': 'cs5',
+                            'password': 'server-password'}),
 
             # no fingerprint field
             ('sslProfile', {'name': 'server-ssl7',
-                             'caCertFile': cls.ssl_file('ca-certificate.pem'),
-                             'certFile': cls.ssl_file('server-certificate.pem'),
-                             'privateKeyFile': cls.ssl_file('server-private-key.pem'),
-                             'uidFormat': 'nsuco',
-                             'password': 'server-password'}),
+                            'caCertFile': cls.ssl_file('ca-certificate.pem'),
+                            'certFile': cls.ssl_file('server-certificate.pem'),
+                            'privateKeyFile': cls.ssl_file('server-private-key.pem'),
+                            'uidFormat': 'nsuco',
+                            'password': 'server-password'}),
 
             # no fingerprint field variation
             ('sslProfile', {'name': 'server-ssl8',
-                             'caCertFile': cls.ssl_file('ca-certificate.pem'),
-                             'certFile': cls.ssl_file('server-certificate.pem'),
-                             'privateKeyFile': cls.ssl_file('server-private-key.pem'),
-                             'uidFormat': 'scounl',
-                             'password': 'server-password'}),
+                            'caCertFile': cls.ssl_file('ca-certificate.pem'),
+                            'certFile': cls.ssl_file('server-certificate.pem'),
+                            'privateKeyFile': cls.ssl_file('server-private-key.pem'),
+                            'uidFormat': 'scounl',
+                            'password': 'server-password'}),
 
-            #no uidFormat
+            # no uidFormat
             ('sslProfile', {'name': 'server-ssl9',
-                             'caCertFile': cls.ssl_file('ca-certificate.pem'),
-                             'certFile': cls.ssl_file('server-certificate.pem'),
-                             'privateKeyFile': cls.ssl_file('server-private-key.pem'),
-                             'password': 'server-password'}),
+                            'caCertFile': cls.ssl_file('ca-certificate.pem'),
+                            'certFile': cls.ssl_file('server-certificate.pem'),
+                            'privateKeyFile': cls.ssl_file('server-private-key.pem'),
+                            'password': 'server-password'}),
 
             # one component of uidFormat is invalid (x), the unrecognized component will be ignored,
             # this will be treated like 'uidFormat': '1'
             ('sslProfile', {'name': 'server-ssl10',
-                             'caCertFile': cls.ssl_file('ca-certificate.pem'),
-                             'certFile': cls.ssl_file('server-certificate.pem'),
-                             'privateKeyFile': cls.ssl_file('server-private-key.pem'),
-                             'uidFormat': '1x',
-                             'uidNameMappingFile': ssl_profile2_json,
-                             'password': 'server-password'}),
+                            'caCertFile': cls.ssl_file('ca-certificate.pem'),
+                            'certFile': cls.ssl_file('server-certificate.pem'),
+                            'privateKeyFile': cls.ssl_file('server-private-key.pem'),
+                            'uidFormat': '1x',
+                            'uidNameMappingFile': ssl_profile2_json,
+                            'password': 'server-password'}),
 
             # All components in the uidFormat are unrecognized, pn_get_transport_user will be returned
             ('sslProfile', {'name': 'server-ssl11',
-                             'caCertFile': cls.ssl_file('ca-certificate.pem'),
-                             'certFile': cls.ssl_file('server-certificate.pem'),
-                             'privateKeyFile': cls.ssl_file('server-private-key.pem'),
-                             'uidFormat': 'abxd',
-                             'password': 'server-password'}),
+                            'caCertFile': cls.ssl_file('ca-certificate.pem'),
+                            'certFile': cls.ssl_file('server-certificate.pem'),
+                            'privateKeyFile': cls.ssl_file('server-private-key.pem'),
+                            'uidFormat': 'abxd',
+                            'password': 'server-password'}),
 
             ('sslProfile', {'name': 'server-ssl12',
-                             'caCertFile': cls.ssl_file('ca-certificate.pem'),
-                             'certFile': cls.ssl_file('server-certificate.pem'),
-                             'privateKeyFile': cls.ssl_file('server-private-key.pem'),
-                             'uidFormat': '1',
-                             'uidNameMappingFile': ssl_profile1_json,
-                             'password': 'server-password'}),
+                            'caCertFile': cls.ssl_file('ca-certificate.pem'),
+                            'certFile': cls.ssl_file('server-certificate.pem'),
+                            'privateKeyFile': cls.ssl_file('server-private-key.pem'),
+                            'uidFormat': '1',
+                            'uidNameMappingFile': ssl_profile1_json,
+                            'password': 'server-password'}),
 
             # should translate a display name
             ('sslProfile', {'name': 'server-ssl13',
@@ -223,9 +223,9 @@
             @param opts: Parsed optoins including connection_options()
         """
         certificate, key, trustfile, password = ssl_options_dict.get('ssl-certificate'), \
-                                                ssl_options_dict.get('ssl-key'), \
-                                                ssl_options_dict.get('ssl-trustfile'), \
-                                                ssl_options_dict.get('ssl-password')
+            ssl_options_dict.get('ssl-key'), \
+            ssl_options_dict.get('ssl-trustfile'), \
+            ssl_options_dict.get('ssl-password')
 
         if not (certificate or trustfile):
             return None
@@ -238,6 +238,7 @@
 
         return domain
 
+
 class QdSSLUseridProxy(QdSSLUseridTest):
 
     def test_message_user_id_proxy_bad_name_disallowed(self):
@@ -266,7 +267,7 @@
         except proton.utils.SendException as e:
             result = e.state
 
-        self.assertTrue (result == Delivery.REJECTED,
+        self.assertTrue(result == Delivery.REJECTED,
                         "Router accepted a message with user_id that did not match connection user_id")
 
     def test_message_user_id_proxy_zzz_credit_handled(self):
@@ -291,7 +292,7 @@
         request = proton.Message()
         request.user_id = BINARY("bad-user-id")
 
-        for i in range(0, credit_limit+1):
+        for i in range(0, credit_limit + 1):
             result = Delivery.ACCEPTED
             try:
                 delivery = blocking_sender.send(request, timeout=10)
diff --git a/tests/test_broker.py b/tests/test_broker.py
index ae5b90b..3a58a01 100644
--- a/tests/test_broker.py
+++ b/tests/test_broker.py
@@ -71,7 +71,7 @@
                 rc = self._deliver_to(c)
                 count += rc
                 if rc == 0:
-                    break;
+                    break
             return count
 
         def _deliver_to(self, consumers):
@@ -82,7 +82,7 @@
                         c.send(self.queue.popleft())
                         result += 1
                 return result
-            except IndexError: # no more messages
+            except IndexError:  # no more messages
                 return 0
 
     def __init__(self, url, container_id=None, **handler_kwargs):
@@ -197,6 +197,7 @@
     Like a broker, but proactively connects to the message bus
     Useful for testing link routes
     """
+
     def __init__(self, url, container_id=None, **handler_kwargs):
         super(FakeService, self).__init__(url, container_id, **handler_kwargs)
 
diff --git a/tests/test_command.py b/tests/test_command.py
index c4202f1..8531b37 100644
--- a/tests/test_command.py
+++ b/tests/test_command.py
@@ -17,7 +17,8 @@
 # under the License.
 #
 
-import argparse, sys
+import argparse
+import sys
 from itertools import combinations
 
 from qpid_dispatch_internal.tools.command import (main,
@@ -29,13 +30,17 @@
 
 from system_test import unittest
 
+
 def mock_error(self, message):
     raise ValueError(message)
 
+
 argparse.ArgumentParser.error = mock_error
 
 # Since BusManager file is definded in tools/qdmanage.in -> tools/qdmanage
 # otherwise it could be just imported
+
+
 class FakeBusManager:
     def displayGeneral(self): pass
     def displayConnections(self): pass
@@ -53,8 +58,10 @@
     def displayLog(self): pass
     def show_all(self): pass
 
+
 FBM = FakeBusManager
 
+
 class TestParseArgsQdstat(unittest.TestCase):
     def setUp(self):
         self.parser = _qdstat_parser(BusManager=FBM)
@@ -64,7 +71,7 @@
 
     def test_parse_args_qdstat_mutually_exclusive(self):
         options1 = ["-g", "-c",
-                    "-l","-n","-e","-a","-m","--autolinks","--linkroutes","--log",
+                    "-l", "-n", "-e", "-a", "-m", "--autolinks", "--linkroutes", "--log",
                     "--all-entities"]
         options2 = ["-r", "--all-routers"]
 
@@ -77,7 +84,7 @@
         _call_pairs(options2)
 
     def test_parse_args_qdstat_default(self):
-        args = parse_args_qdstat(FBM, argv = [])
+        args = parse_args_qdstat(FBM, argv=[])
         self.assertEqual(FBM.displayGeneral.__name__, args.show)
 
     def test_parse_args_qdstat_method_show_matching(self):
@@ -104,6 +111,7 @@
         args = self.parser.parse_args(["--limit", "1"])
         self.assertEqual(1, args.limit)
 
+
 class TestParseArgsQdmanage(unittest.TestCase):
     def setUp(self):
         self.operations = ["HERE", "SOME", "OPERATIONS"]
@@ -143,13 +151,13 @@
 
         self.assertEqual(0, main(run_success))
         failed_runs = [
-            #run_raises_UsageError, ##uncomment this exposes bug
+            # run_raises_UsageError, ##uncomment this exposes bug
             run_raises_Exception,
             run_raises_KeyboardInterrupt,
         ]
         for run in failed_runs:
             self.assertEqual(1, main(run))
 
+
 if __name__ == '__main__':
     unittest.main()
-
diff --git a/tools/qdmanage.in b/tools/qdmanage.in
index 31f1ddd..9306ff3 100755
--- a/tools/qdmanage.in
+++ b/tools/qdmanage.in
@@ -24,8 +24,10 @@
 from __future__ import absolute_import
 from __future__ import print_function
 
-import sys, json, re
-import  qpid_dispatch_site
+import sys
+import json
+import re
+import qpid_dispatch_site
 import argparse
 try:
     from collections.abc import Mapping, Sequence
@@ -41,6 +43,7 @@
 
 INTEGER_TYPE = "integer"
 
+
 def attr_split(attrstr, qd_schema, type):
     """Split an attribute string of the form name=value or name to indicate None"""
     nv = attrstr.split("=", 1)
@@ -87,11 +90,11 @@
                                  edge_router=self.opts.edge_router)
 
         operation = self.args.pop(0)
-        method = operation.lower().replace('-','_')
+        method = operation.lower().replace('-', '_')
         if operation.upper() in self.operations and hasattr(self, method):
-            getattr(self, method)() # Built-in operation
+            getattr(self, method)()  # Built-in operation
         else:
-            self.operation(operation) # Custom operation
+            self.operation(operation)  # Custom operation
 
     def main(self, argv):
         return main(self.run, argv, self.op)
@@ -102,7 +105,8 @@
 
     def print_result(self, result):
         """Print a string result as-is, else try json dump, else print as-is"""
-        if not result: return
+        if not result:
+            return
         if isinstance(result, (PY_STRING_TYPE, PY_TEXT_TYPE)):
             print("%s" % result)
         else:
@@ -145,7 +149,8 @@
                 self.print_json(func(data).attributes)
             elif isinstance(data, Sequence):
                 self.print_json([func(attrs).attributes for attrs in data])
-            else: raise ValueError("stdin is not a JSON map or list")
+            else:
+                raise ValueError("stdin is not a JSON map or list")
         else:
             self.print_json(func(self.opts.attributes).attributes)
 
@@ -212,7 +217,7 @@
         try:
             return json.loads(value)
         except ValueError as e:
-            if not re.search(r'["{}\[\]]', value): # Doesn't look like attempted JSON.
+            if not re.search(r'["{}\[\]]', value):  # Doesn't look like attempted JSON.
                 return value    # Just treat as plain string
             raise ValueError("Invalid JSON '%s': %s" % (value, e))
 
@@ -227,5 +232,6 @@
         request = self.call_node('request', 'type', 'name', 'identity', operation=operation, body=body, **properties)
         self.print_result(self.node.call(request).body)
 
+
 if __name__ == "__main__":
     sys.exit(QdManage().main(sys.argv))
diff --git a/tools/qdstat.in b/tools/qdstat.in
index c878a04..7404099 100755
--- a/tools/qdstat.in
+++ b/tools/qdstat.in
@@ -41,9 +41,11 @@
                                                   opts_url)
 from qpid_dispatch_internal.compat import UNICODE
 
+
 def get(obj, attr):
     return getattr(obj, attr, None)
 
+
 class BusManager(object):
 
     schema = QdSchema()
@@ -71,12 +73,12 @@
 
     def connAuth(self, conn):
         ##
-        ## Summarize the authentication for a connection:
-        ##   no-auth
-        ##   anonymous-user
-        ##   <user>(PLAIN)
-        ##   <user>(kerberos)
-        ##   <user>(x.509)
+        # Summarize the authentication for a connection:
+        # no-auth
+        # anonymous-user
+        # <user>(PLAIN)
+        # <user>(kerberos)
+        # <user>(x.509)
         ##
         if not conn.isAuthenticated:
             return "no-auth"
@@ -93,11 +95,11 @@
 
     def connSecurity(self, conn):
         ##
-        ## Summarize the security of a connection:
-        ##   no-security
+        # Summarize the security of a connection:
+        # no-security
         ##   SSLv3 (cipher)
         ##   TLS (cipher)
-        ##   Kerberos
+        # Kerberos
         ##
         if not conn.isEncrypted:
             return "no-security"
@@ -106,7 +108,7 @@
         return "%s(%s)" % (conn.sslProto, conn.sslCipher)
 
     def noTrailingSlash(self, text):
-        if text == None:
+        if text is None:
             return ""
         if text[-1:] == '/':
             return text[:-1]
@@ -123,7 +125,6 @@
         self.displayRouterId()
         print("")
 
-
     def displayEdges(self, show_date_id=True):
         disp = Display(prefix="  ", bodyFormat=self.bodyFormat)
         heads = []
@@ -135,10 +136,10 @@
         heads.append(Header("security"))
         heads.append(Header("authentication"))
         heads.append(Header("tenant"))
-        
+
         rows = []
         objects = self.query('org.apache.qpid.dispatch.connection', limit=self.opts.limit)
-        
+
         if not objects:
             if show_date_id:
                 self.display_datetime_router_id()
@@ -149,7 +150,7 @@
             self.display_datetime_router_id()
 
         has_active = False
-        
+
         first = objects[0]
         try:
             if first:
@@ -157,36 +158,36 @@
                 has_active = True
         except:
             pass
-            
+
         if has_active:
             heads.append(Header("active"))
-        
+
         for conn in objects:
             if conn.role == "edge":
-               row = []
-               row.append(conn.identity)
-               row.append(conn.host)
-               row.append(conn.container)
-               row.append(conn.role)
-               row.append(conn.dir)
-               row.append(self.connSecurity(conn))
-               row.append(self.connAuth(conn))
-               row.append(self.noTrailingSlash(get(conn, 'tenant')))
-               if has_active:
-                   if conn.active:
-                       row.append("yes")
-                   else:
-                       row.append("no")
-               rows.append(row)
-        
+                row = []
+                row.append(conn.identity)
+                row.append(conn.host)
+                row.append(conn.container)
+                row.append(conn.role)
+                row.append(conn.dir)
+                row.append(self.connSecurity(conn))
+                row.append(self.connAuth(conn))
+                row.append(self.noTrailingSlash(get(conn, 'tenant')))
+                if has_active:
+                    if conn.active:
+                        row.append("yes")
+                    else:
+                        row.append("no")
+                rows.append(row)
+
         if rows:
             title = "Connections"
         else:
             return
-        
+
         dispRows = rows
-        disp.formattedTable(title, heads, dispRows)            
-        
+        disp.formattedTable(title, heads, dispRows)
+
     def displayConnections(self, show_date_id=True):
         disp = Display(prefix="  ", bodyFormat=self.bodyFormat)
         heads = []
@@ -264,18 +265,25 @@
                 return "%s:%s" % (phase, text)
         return "%s:%s" % (cls, text)
 
-
     def _addr_class(self, addr):
         if not addr:
             return ""
-        if addr[0] == 'M'  : return "mobile"
-        if addr[0] == 'R'  : return "router"
-        if addr[0] == 'A'  : return "area"
-        if addr[0] == 'L'  : return "local"
-        if addr[0] == 'T'  : return "topo"
-        if addr[0] in 'CE' : return "link-in"
-        if addr[0] in 'DF' : return "link-out"
-        if addr[0] == 'H'  : return "edge"
+        if addr[0] == 'M'  :
+            return "mobile"
+        if addr[0] == 'R'  :
+            return "router"
+        if addr[0] == 'A'  :
+            return "area"
+        if addr[0] == 'L'  :
+            return "local"
+        if addr[0] == 'T'  :
+            return "topo"
+        if addr[0] in 'CE' :
+            return "link-in"
+        if addr[0] in 'DF' :
+            return "link-out"
+        if addr[0] == 'H'  :
+            return "edge"
         return "unknown: %s" % addr[0]
 
     def _addr_text(self, addr):
@@ -337,7 +345,7 @@
             rows.append(('Uptime',        TimeLong(router.uptimeSeconds)))
         except:
             pass
-            
+
         try:
             if router.memoryUsage > 0:
                 rows.append(('VmSize', NumKMG(router.memoryUsage,
@@ -527,7 +535,7 @@
                 if float(node.lastTopoChange) > lastTopoChange:
                     lastTopoChange = float(node.lastTopoChange)
             row.append(node.id)
-            if node.nextHop != None:
+            if node.nextHop is not None:
                 row.append(node.nextHop)
                 row.append('-')
             else:
@@ -544,7 +552,7 @@
             title = "Routers in the Network"
             # Use gmtime to make times comparable across large networks.
             if lastTopoChange > 1.0:
-                topoLine = "\nLast Topology Change: " + strftime('%A %b %d %H:%M:%S %Y',gmtime(lastTopoChange)) + " GMT"
+                topoLine = "\nLast Topology Change: " + strftime('%A %b %d %H:%M:%S %Y', gmtime(lastTopoChange)) + " GMT"
                 title += topoLine
             sort = Sorter(heads, rows, 'router-id')
             dispRows = sort.getSorted()
@@ -695,7 +703,7 @@
                     row.append(link_route.delExternalPrefix)
                     have_add_del_prefix = True
             except KeyError:
-                pass # added post 1.1.0
+                pass  # added post 1.1.0
             rows.append(row)
         title = "Link Routes"
         if have_add_del_prefix:
@@ -771,7 +779,6 @@
                              Header("Pooled", Header.KiMiGi)],
                             [rows])
 
-
     def displayPolicy(self, show_date_id=True):
         disp = Display(prefix="  ", bodyFormat=self.bodyFormat)
         heads = []
@@ -991,11 +998,9 @@
                         vstat.hostname,
                         ustate,
                         ustates[ustate]
-                        ))
+                    ))
         disp.formattedTable("\nVhost User Stats", heads, rows)
 
-
-
     def displayLog(self):
         log = self.node.get_log(limit=self.opts.limit)
         for line in log:
@@ -1039,7 +1044,7 @@
             if len(all_nodes) < 2:
                 has_nodes = False
         else:
-           has_nodes = False
+            has_nodes = False
 
         return has_nodes, all_nodes
 
@@ -1050,7 +1055,7 @@
             if len(all_nodes) < 2:
                 has_nodes = False
         else:
-           has_nodes = False
+            has_nodes = False
 
         return has_nodes, all_nodes
 
@@ -1061,7 +1066,7 @@
             for node in nodes:
                 self.node.set_client(node[6:])
                 parts = node.split("/")
-                print ("Router ", parts[3])
+                print("Router ", parts[3])
                 print("")
                 if self.show.__name__ == 'show_all':
                     self.show(show_summary=False)
@@ -1071,6 +1076,7 @@
         else:
             self.show()
 
+
 def run(argv):
     args = parse_args_qdstat(BusManager)
     bm = BusManager(args)
@@ -1079,5 +1085,6 @@
     finally:
         bm.close()
 
+
 if __name__ == "__main__":
     sys.exit(main(run))
diff --git a/tools/scraper/amqp_detail.py b/tools/scraper/amqp_detail.py
index c5a9f44..8a2de9b 100755
--- a/tools/scraper/amqp_detail.py
+++ b/tools/scraper/amqp_detail.py
@@ -34,22 +34,24 @@
 Given a map of all connections with lists of the associated frames
 analyze and show per-connection, per-session, and per-link details.
 
-This is done in a two-step process: 
- * Run through the frame lists and generates an intermediate structure 
+This is done in a two-step process:
+ * Run through the frame lists and generates an intermediate structure
    with the the details for display.
  * Generate the html from the detail structure.
 This strategy allows for a third step that would allow more details
 to be gleaned from the static details. For instance, if router A
-sends a transfer to router B then router A's details could show 
+sends a transfer to router B then router A's details could show
 how long it took for the transfer to reach router B. Similarly
-router B's details could show how long ago router A sent the transfer. 
+router B's details could show how long ago router A sent the transfer.
 """
 
+
 class Counts():
     """
     Holds common count sets that can be rolled up from links to
     sessions to connections. Not for individual performatives.
     """
+
     def __init__(self):
         # amqp errors gleaned from any performative
         self.errors = 0    # amqp error - simple count
@@ -68,9 +70,9 @@
         self.drain = 0
         # link out of credit
         self.credit_not_evaluated = 0
-        self.no_credit = 0 # event count, excludes drain credit exhaustion
-        self.initial_no_credit_duration = datetime.timedelta() # before first credit
-        self.no_credit_duration = datetime.timedelta() # after credit issued and then exhausted
+        self.no_credit = 0  # event count, excludes drain credit exhaustion
+        self.initial_no_credit_duration = datetime.timedelta()  # before first credit
+        self.no_credit_duration = datetime.timedelta()  # after credit issued and then exhausted
 
     def highlight(self, name, value, color):
         """
@@ -137,7 +139,6 @@
                "<th><span title=\"Normal credit exhaustion stall (S)\">duration (S)</span></th>" \
                "<th><span title=\"Credit not evaluated\">?</span></th>"
 
-
     def show_table_element(self, name, value, color):
         return ("<td>%s</td>" % text.nbsp()) if value == 0 else \
             ("<td>%s</td>" % ("<span style=\"background-color:%s\">%s</span> " % (color, str(value))))
@@ -168,7 +169,6 @@
         return res
 
 
-
 class ConnectionDetail():
     """
     Holds facts about sessions over the connection's lifetime
@@ -395,7 +395,6 @@
 
         self.unsettled_list = []
 
-
         # paired handles
         self.output_handle = -1
         self.input_handle = -1
@@ -569,9 +568,9 @@
                     conn_details.unaccounted_frame_list.append(plf)
                     continue
                 # session required
-                channel = plf.data.channel # Assume in/out channels are the same for the time being
+                channel = plf.data.channel  # Assume in/out channels are the same for the time being
                 sess_details = conn_details.FindSession(channel)
-                if sess_details == None:
+                if sess_details is None:
                     new_id = len(conn_details.session_list)
                     sess_details = SessionDetail(new_id, conn_details, conn_details.GetSeqNo(), plf.datetime)
                     conn_details.session_list.append(sess_details)
@@ -583,7 +582,7 @@
                     sess_details.counts.errors += 1
 
                 if pname in ['begin', 'end', 'disposition']:
-                    sess_details.session_frame_list.append(plf) # Accumulate to current session
+                    sess_details.session_frame_list.append(plf)  # Accumulate to current session
                     if pname == 'end':
                         # end is closing this session
                         if sess_details.half_closed:
@@ -591,7 +590,7 @@
                         else:
                             sess_details.half_closed = True
                     else:
-                        pass # begin handled above; disposition needs no action
+                        pass  # begin handled above; disposition needs no action
 
                 elif pname in ['attach']:
                     handle = plf.data.handle  # proton local handle
@@ -778,8 +777,8 @@
                     look_for_sender_delivery_id = True
                     dir_of_xfer = ''
                     dir_of_flow = ''
-                    current_delivery = 0 # next transfer expected id
-                    delivery_limit = 0 # first unreachable delivery id from flow
+                    current_delivery = 0  # next transfer expected id
+                    delivery_limit = 0  # first unreachable delivery id from flow
                     n_attaches = 0
                     tod_of_second_attach = None
                     multiframe_in_progress = False
@@ -799,7 +798,7 @@
                     #  sndr  ->   ->        <-            A
                     #
                     if (((is_rcvr) and (o_dir == text.direction_in())) or
-                        ((not is_rcvr) and (o_dir == text.direction_out()))):
+                            ((not is_rcvr) and (o_dir == text.direction_out()))):
                         # case A
                         dir_of_xfer = text.direction_out()
                         dir_of_flow = text.direction_in()
@@ -836,7 +835,7 @@
                                     link.counts.initial_no_credit_duration = dur
                                     sess.counts.initial_no_credit_duration += dur
                                     conn_detail.counts.initial_no_credit_duration += dur
-                                if credit_stall and delivery_limit > current_delivery: # TODO: wrap
+                                if credit_stall and delivery_limit > current_delivery:  # TODO: wrap
                                     credit_stall = False
                                     plf.data.web_show_str += " <span style=\"background-color:%s\">credit restored</span>" % common.color_of("no_credit")
                                     dur = plf.datetime - tod_of_no_credit
@@ -852,7 +851,7 @@
                             if plf.data.direction == dir_of_xfer:
                                 if not plf.data.transfer_more:
                                     # consider the transfer to have arrived when last transfer seen
-                                    current_delivery += 1 # TODO: wrap at 32-bits
+                                    current_delivery += 1  # TODO: wrap at 32-bits
                                     if current_delivery == delivery_limit:
                                         link.counts.no_credit += 1
                                         sess.counts.no_credit += 1
@@ -862,7 +861,7 @@
                                         plf.data.web_show_str += " <span style=\"background-color:%s\">no more credit</span>" % common.color_of("no_credit")
                                         tod_of_no_credit = plf.datetime
                                     else:
-                                        pass # still have credit
+                                        pass  # still have credit
                                     multiframe_in_progress = False
                                 else:
                                     # transfers with 'more' set don't consume credit
@@ -898,7 +897,7 @@
                             link.counts.initial_no_credit_duration = dur
                             sess.counts.initial_no_credit_duration += dur
                             conn_detail.counts.initial_no_credit_duration += dur
-                        if credit_stall: # TODO: wrap
+                        if credit_stall:  # TODO: wrap
                             dur = tod_of_shutdown - tod_of_no_credit
                             link.counts.no_credit_duration += dur
                             sess.counts.no_credit_duration += dur
@@ -923,7 +922,7 @@
             peer = self.rtr.conn_peer_display.get(id, "")  # peer container id
             peerconnid = self.comn.conn_peers_connid.get(id, "")
             # show the connection title
-            print("%s %s %s %s (nFrames=%d) %s<br>" % \
+            print("%s %s %s %s (nFrames=%d) %s<br>" %
                   (id, dir, peerconnid, peer, len(conn_frames), conn_detail.counts.show_html()))
             # data div
             print("<div id=\"%s_data\" style=\"display:none; margin-bottom: 2px; margin-left: 10px\">" % id)
@@ -944,8 +943,8 @@
                 # show the session 'toggle goto' and title
                 print("<a href=\"javascript:toggle_node('%s_sess_%s')\">%s%s</a>" %
                       (id, sess.conn_epoch, text.lozenge(), text.nbsp()))
-                print("Session %s: channel: %s, peer channel: %s; Time: start %s, Counts: frames: %d %s<br>" % \
-                      (sess.conn_epoch, sess.channel, sess.peer_chan, sess.time_start, \
+                print("Session %s: channel: %s, peer channel: %s; Time: start %s, Counts: frames: %d %s<br>" %
+                      (sess.conn_epoch, sess.channel, sess.peer_chan, sess.time_start,
                        sess.FrameCount(), sess.counts.show_html()))
                 print("<div id=\"%s_sess_%s\" style=\"display:none; margin-bottom: 2px; margin-left: 10px\">" %
                       (id, sess.conn_epoch))
@@ -970,10 +969,10 @@
                     showthis = ("<a href=\"javascript:toggle_node('%s_sess_%s_link_%s')\">%s</a>" %
                                 (id, sess.conn_epoch, link.session_seq, text.lozenge()))
                     visitthis = ("<a href=\"#%s_sess_%s_link_%s_data\">%s</a>" %
-                                (id, sess.conn_epoch, link.session_seq, link.display_name))
+                                 (id, sess.conn_epoch, link.session_seq, link.display_name))
                     role = "receiver" if link.is_receiver else "sender"
                     print("<tr><td>%s %s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td>"
-                          "<td>%s</td><td>%d</td><td>%s</td> </tr>" % \
+                          "<td>%s</td><td>%d</td><td>%s</td> </tr>" %
                           (showthis, visitthis, link.direction, role, link.first_address,
                            (link.sender_class + '-' + link.receiver_class), link.snd_settle_mode,
                            link.rcv_settle_mode, link.time_start, link.FrameCount(),
@@ -985,7 +984,7 @@
                         "<div id=\"%s_sess_%s_link_%s\" style=\"display:none; margin-top: 2px; margin-bottom: 2px; margin-left: 10px\">" %
                         (id, sess.conn_epoch, link.session_seq))
                     print("<a name=\"%s_sess_%s_link_%s_data\"></a>" %
-                                (id, sess.conn_epoch, link.session_seq))
+                          (id, sess.conn_epoch, link.session_seq))
                     print("<h4>Connection %s Session %s Link %s</h4>" %
                           (id, sess.conn_epoch, link.display_name))
                     for plf in link.frame_list:
diff --git a/tools/scraper/common.py b/tools/scraper/common.py
index cdd04ec..248e65f 100755
--- a/tools/scraper/common.py
+++ b/tools/scraper/common.py
@@ -30,14 +30,17 @@
 if IS_PY2:
     def dict_iteritems(d):
         return d.iteritems()
+
     def dict_iterkeys(d):
         return d.iterkeys()
 else:
     def dict_iteritems(d):
         return iter(d.items())
+
     def dict_iterkeys(d):
         return iter(d.keys())
 
+
 class Common():
 
     # analysis_level_ludicrous
@@ -61,7 +64,7 @@
 
     # discovered router container names
     # len=n_logs
-    router_ids = [] # raw long names
+    router_ids = []  # raw long names
 
     # router display names shortened with popups
     router_display_names = []
@@ -140,6 +143,7 @@
         sys.exit('ERROR: too many log files')
     return "ABCDEFGHIJKLMNOPQRSTUVWXYZ"[idx]
 
+
 def index_of_log_letter(letter):
     '''
     Return the index 0..25 of the firster letter of the 'letter' string
@@ -152,6 +156,7 @@
         raise ValueError("index_of_log_letter Invalid log letter: %s", letter)
     return val
 
+
 class RestartRec():
     def __init__(self, _id, _router, _event, _datetime):
         self.id = _id
@@ -159,10 +164,12 @@
         self.event = _event
         self.datetime = _datetime
 
+
 def transfer_is_possibly_unsettled(plf):
     return (plf.data.transfer and not plf.data.transfer_more and
             not (plf.data.transfer_settled or plf.data.final_disposition is not None))
 
+
 global_colors = {
     "errors": "yellow",
     "unsettled": "tomato",
@@ -177,17 +184,21 @@
     "no_credit": "beige"
 }
 
+
 def color_of(obj_type):
     return global_colors.get(obj_type, "pink")
 
+
 html_escape_table = {
     "&": "&amp;",
     ">": "&gt;",
     "<": "&lt;",
 }
 
+
 def html_escape(text):
-    return "".join(html_escape_table.get(c,c) for c in text)
+    return "".join(html_escape_table.get(c, c) for c in text)
+
 
 def strings_of_proton_log(text):
     '''
@@ -199,8 +210,8 @@
     :param text:
     :return: strings embedded in text
     '''
-    r = "" # return result
-    sstate = 0 # when a backslash is seen, skip this many more input chars
+    r = ""  # return result
+    sstate = 0  # when a backslash is seen, skip this many more input chars
     skipping = False
     for elem in text:
         if sstate > 0:
@@ -216,6 +227,7 @@
                 r += elem
     return r
 
+
 def ls_eval(text):
     '''
     Given a router_ls cost string like '{u'A': 1, u'C': 51L, u'B': 101L}',
diff --git a/tools/scraper/log_splitter.py b/tools/scraper/log_splitter.py
index b7ff480..0d7e041 100755
--- a/tools/scraper/log_splitter.py
+++ b/tools/scraper/log_splitter.py
@@ -38,6 +38,7 @@
 import common
 import text
 
+
 class connection():
     def __init__(self, instance, conn_id, logfile):
         self.instance = instance
@@ -73,6 +74,7 @@
     Parse an attach log line. The usual parser is way too slow
     so this does the essentials for --split.
     """
+
     def find_field(self, key, line):
         sti = line.find(key)
         if sti < 0:
@@ -85,7 +87,6 @@
             val = val[1:-1]
         return val
 
-
     def __init__(self, instance, line, opaque):
         self.instance = instance
         self.line = line
@@ -155,6 +156,7 @@
         self.source = self.find_field('@source(40) [address=', self.line)
         self.target = self.find_field('@target(41) [address=', self.line)
 
+
 class LogFile:
     def __init__(self, fn, top_n=24):
         """
@@ -165,7 +167,7 @@
         self.log_fn = fn    # file name
         self.top_n = top_n  # how many to report
         self.instance = 0   # incremented when router restarts in log file
-        self.amqp_lines = 0 # server trace lines
+        self.amqp_lines = 0  # server trace lines
         self.transfers = 0  # server transfers
         self.attaches = 0   # server attach
 
@@ -201,7 +203,7 @@
         # histogram - count of connections with N logs < 10^index
         # [0] = N < 10^0
         # [1] = N < 10^1
-        self.histogram = [0,0,0,0,0,0,0,0,0,0]
+        self.histogram = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
         self.hist_max = len(self.histogram) - 1
 
     def parse_identify(self, text, line, before_col=70):
@@ -226,7 +228,7 @@
         """
         key_sstart = "SERVER (info) Container Name:"  # Normal 'router is starting' restart discovery line
         key_strace = "SERVER (trace) ["  # AMQP traffic
-        key_ptrace = "PROTOCOL (trace) [" # AMQP traffic
+        key_ptrace = "PROTOCOL (trace) ["  # AMQP traffic
         key_error = "@error(29)"
         key_openin = "<- @open(16)"
         key_xfer = "@transfer"
@@ -307,13 +309,12 @@
         # create grand list of all connections
         for cursize in slist:
             lsm = smap[str(cursize)]
-            lsm = sorted(lsm, key = sortfunc2, reverse=True)
+            lsm = sorted(lsm, key=sortfunc2, reverse=True)
             #lsm = sorted(lsm, key = lambda x: int(x.conn_id))
             for ls in lsm:
                 conns_by_size.append(ls)
         return conns_by_size
 
-
     def summarize_connections(self):
         # sort connections based on transfer count and on n log lines
         self.conns_by_size_transfer = self.sort_sizes(lambda x: x.transfers, lambda x: len(x.lines))
@@ -325,14 +326,14 @@
             v.generate_paths()
 
         # Write the web doc to stdout
-        print ("""<!DOCTYPE html>
+        print("""<!DOCTYPE html>
 <html>
 <head>
 <title>%s qpid-dispatch log split</title>
 
 <style>
-    * { 
-    font-family: sans-serif; 
+    * {
+    font-family: sans-serif;
 }
 table {
     border-collapse: collapse;
@@ -349,7 +350,7 @@
 {
   if(dojo.isString(node))
     node = dojo.byId(node);
-  if(!node) 
+  if(!node)
     return false;
   return node.style.display == "block";
 }
@@ -415,7 +416,7 @@
         print("<a name=\"c_restarts\"></a>")
         print("<h3>Restarts</h3>")
         for i in range(1, (self.instance + 1)):
-            rr = self.restarts[i-1]
+            rr = self.restarts[i - 1]
             print("(%d) - %s<br>" % (i, rr), end='')
         print("<hr>")
 
@@ -443,12 +444,12 @@
         print("</table>")
         print("<hr>")
 
-        ## histogram
-        #for cursize in self.sizelist:
+        # histogram
+        # for cursize in self.sizelist:
         #    self.histogram[self.log_of(cursize)] += len(self.sizemap[str(cursize)])
-        #print()
+        # print()
         #print("Log lines per connection distribution")
-        #for i in range(1, self.hist_max):
+        # for i in range(1, self.hist_max):
         #    print("N <  10e%d : %d" %(i, self.histogram[i]))
         #print("N >= 10e%d : %d" % ((self.hist_max - 1), self.histogram[self.hist_max]))
 
@@ -468,7 +469,7 @@
     def write_subfiles(self):
         # Q: Where to put the generated files? A: odir
         odir = self.odir()
-        odirs = ['dummy'] # dirs indexed by log of n-lines
+        odirs = ['dummy']  # dirs indexed by log of n-lines
 
         os.makedirs(odir)
         for i in range(1, self.hist_max):
@@ -574,7 +575,7 @@
             visitthis = ("<a href=\"#@@addr2_%d_data\">%s</a>" %
                          (n, k))
             line = ("<tr><td>%s %s</td> <td>%d</td> </tr>" %
-                  (showthis, visitthis, len(plfs)))
+                    (showthis, visitthis, len(plfs)))
             if len(plfs) <= ADDR_LEVEL:
                 addr_few.append(line)
             else:
@@ -586,7 +587,8 @@
         print("<div id=\"addr_table_many\" style=\"display:none; margin-top: 2px; margin-bottom: 2px; margin-left: 10px\">")
         print("<h4>Addresses with many links (N=%d)</h4>" % (len(addr_many)))
         print("<table><tr> <th>Address</th> <th>N References</th> </tr>")
-        for line in addr_many: print(line)
+        for line in addr_many:
+            print(line)
         print("</table>")
         print("</div>")
 
@@ -596,7 +598,8 @@
         print("<div id=\"addr_table_few\" style=\"display:none; margin-top: 2px; margin-bottom: 2px; margin-left: 10px\">")
         print("<h4>Addresses with few links (N=%d)</h4>" % (len(addr_few)))
         print("<table><tr> <th>Address</th> <th>N References</th> </tr>")
-        for line in addr_few: print(line)
+        for line in addr_few:
+            print(line)
         print("</table>")
         print("</div>")
 
@@ -628,11 +631,13 @@
 if IS_PY2:
     def dict_iteritems(d):
         return d.iteritems()
+
     def dict_iterkeys(d):
         return d.iterkeys()
 else:
     def dict_iteritems(d):
         return iter(d.items())
+
     def dict_iterkeys(d):
         return iter(d.keys())
 
@@ -660,7 +665,7 @@
 
     # write output
     for lf in log_files:
-        lf.summarize_connections() # prints web page to console
+        lf.summarize_connections()  # prints web page to console
         lf.write_subfiles()        # generates split files one-per-connection
         lf.aggregate_addresses()   # print address table html to console
 
diff --git a/tools/scraper/nicknamer.py b/tools/scraper/nicknamer.py
index 540d829..556fcdd 100755
--- a/tools/scraper/nicknamer.py
+++ b/tools/scraper/nicknamer.py
@@ -22,15 +22,18 @@
 from collections import defaultdict
 import common
 
+
 class ShortNameSorter():
     '''
     Class to hold registered name and TOD in a list for sort purposes:
       the lname was observed at this datetime.
     '''
+
     def __init__(self, lname, datetime):
         self.lname = lname
         self.datetime = datetime
 
+
 class ShortNames():
     '''
     Name shortener.
@@ -44,6 +47,7 @@
     * The dict index is the object name and the value is a list of log lines using that name
     * Sorting the customers puts their usage of the name in time order
     '''
+
     def __init__(self, prefixText, _threshold=25):
         self.longnames = []
         self.prefix = prefixText
@@ -114,7 +118,7 @@
         if not sname.startswith(self.prefix):
             raise ValueError("Short name '%s' does not start with prefix '%s'" % (sname, self.prefix))
         try:
-            lname = self.longnames[ int(sname[ (len(self.prefix) + 1): ])]
+            lname = self.longnames[int(sname[(len(self.prefix) + 1):])]
         except:
             raise ValueError("Short name '%s' did not translate to a long name" % (sname))
         return "<span title=\"" + common.html_escape(lname) + sname + "</span>"
@@ -136,8 +140,8 @@
         :return: null
         '''
         if len(self.longnames) > 0:
-            print ("<h3>" + self.prefix + " Name Index</h3>")
-            print ("<ul>")
+            print("<h3>" + self.prefix + " Name Index</h3>")
+            print("<ul>")
             for i in range(0, len(self.longnames)):
                 name = self.prefix + "_" + str(i)
                 dump_anchor = "<a name=\"%s_dump\"></a>" % (name)
@@ -146,8 +150,8 @@
                 line = self.longnames[i]
                 if log_strings:
                     line = common.strings_of_proton_log(line)
-                print ("<li> " + dump_anchor + name + " - " + common.html_escape(line) + "</li>")
-            print ("</ul>")
+                print("<li> " + dump_anchor + name + " - " + common.html_escape(line) + "</li>")
+            print("</ul>")
 
     def sort_customers(self):
         for c in common.dict_iterkeys(self.customer_dict):
diff --git a/tools/scraper/parser.py b/tools/scraper/parser.py
index c0c998a..a9042a3 100755
--- a/tools/scraper/parser.py
+++ b/tools/scraper/parser.py
@@ -40,6 +40,7 @@
 """
 SEQUENCE_TRANSFER_SIZE = 50
 
+
 def colorize_bg(what):
     # TODO: use the real colorize_bg
     return what
@@ -104,7 +105,7 @@
 
     def __init__(self):
         self.web_show_str = ""
-        self.sdorg_str = "" # text for sequence diagram source
+        self.sdorg_str = ""  # text for sequence diagram source
         self.name = ""
         self.conn_num = ""  # source router's undecorated conn num
         self.conn_id = ""  # decorated routerPrefixLetter'instanceNumber-conn_num
@@ -150,7 +151,7 @@
         self.is_policy_trace = False  # line is POLICY (trace)
         self.is_server_info = False  # line is SERVER (info)
         self.is_router_ls = False  # line is ROUTER_LS (info)
-        self.is_scraper = False # line is SCRAPER (any-level)
+        self.is_scraper = False  # line is SCRAPER (any-level)
         self.fid = ""  # Log line (frame) id as used in javascript code
         self.amqp_error = False
         self.link_class = "client"  # attach sees: normal, router, router-data (, management?)
@@ -333,7 +334,6 @@
                         subfields.append(fields[0])
                         del fields[0]
 
-
                 subtype = DescribedType()
                 subtype.parse_dtype_line(val, ' '.join(subfields))
                 self.dict[key] = subtype
@@ -537,7 +537,7 @@
             res.web_show_str = ("<strong>%s</strong>  [%s] (%s %s-%s settled=%s state=%s)" %
                                 (res.name, res.channel, res.role, res.first, res.last, res.settled, res.disposition_state))
             res.sdorg_str = ("%s  [%s] (%s %s-%s settled=%s state=%s)" %
-                                (res.name, res.channel, res.role, res.first, res.last, res.settled, res.disposition_state))
+                             (res.name, res.channel, res.role, res.first, res.last, res.settled, res.disposition_state))
 
         elif perf == 0x16:
             # Performative: detach [channel, handle]
@@ -746,8 +746,8 @@
                                 (res.name, colorize_bg(res.channel_handle), res.role, res.link_short_name_popup,
                                  res.source, res.target, res.link_class))
             res.sdorg_str =  ("%s %s %s %s (src: %s, tgt: %s)" %
-                                (res.name, res.channel_handle, res.role, res.link_short_name,
-                                 res.source, res.target))
+                              (res.name, res.channel_handle, res.role, res.link_short_name,
+                               res.source, res.target))
         elif perf == 0x14:
             # Performative: transfer [channel,handle] (id)
             self.transfer_short_name = self.shorteners.short_data_names.translate(res.transfer_bare, customer=self)
@@ -889,13 +889,13 @@
                 sti += len(verbatim_module)
                 self.data.is_scraper = True
                 self.data.web_show_str = ("<strong>%s</strong> %s" % (verbatim_module, common.html_escape(self.line[sti:])))
-                stcp = self.line[sti:].find(')') # close paren after log level
+                stcp = self.line[sti:].find(')')  # close paren after log level
                 if stcp <  0:
                     stcp = 0
                 self.data.sdorg_str = self.line[sti + stcp + 1:]
                 return
             else:
-                assert False # verbatim module was found only moments ago...
+                assert False  # verbatim module was found only moments ago...
 
         # extract connection number
         sti = self.line.find(self.server_trace_key)
@@ -1020,7 +1020,7 @@
     key3 = "ROUTER_LS (info)"  # a log line placed in separate pool of lines
     keys = [key1, key3]
     key4 = "ROUTER (info) Version:"  # router version line
-    key5 = "ROUTER (info) Router started in " # router mode
+    key5 = "ROUTER (info) Router started in "  # router mode
     with open(fn, 'r') as infile:
         for line in infile:
             if search_for_in_progress:
diff --git a/tools/scraper/router.py b/tools/scraper/router.py
index 9fd3835..a44a1e2 100755
--- a/tools/scraper/router.py
+++ b/tools/scraper/router.py
@@ -41,6 +41,7 @@
 import common
 import text
 
+
 class RestartRecord():
     def __init__(self, _router, _line, _lineno):
         self.router = _router
@@ -55,6 +56,7 @@
         return "%d instance %d start %s #%d" % (self.router.log_index, self.router.instance,
                                                 self.datetime, self.lineno)
 
+
 class Router():
     '''A single dispatch boot-and-run instance from a log file'''
 
@@ -124,7 +126,6 @@
         # details: for each connection, for each session, for each link, whaaa?
         self.details = None
 
-
     def discover_connection_facts(self, comn):
         '''
         Discover all the connections in this router-instance log
@@ -163,7 +164,7 @@
             if item.data.name == "open" and item.data.direction == text.direction_in():
                 if item.data.conn_id in self.conn_peer:
                     sys.exit('ERROR: file: %s connection %s has multiple connection peers' % (
-                    self.fn, id))
+                        self.fn, id))
                 self.conn_peer[id] = item.data.conn_peer
                 self.conn_peer_display[id] = comn.shorteners.short_peer_names.translate(
                     item.data.conn_peer, True)
@@ -203,8 +204,9 @@
         return (router_list[0], 0)
     for i in range(1, len(router_list)):
         if at_time < router_list[i].restart_rec.datetime:
-            return (router_list[i-1], i-1)
-    return (router_list[-1], len(router_list)-1)
+            return (router_list[i - 1], i - 1)
+    return (router_list[-1], len(router_list) - 1)
+
 
 def which_router_id_tod(routers, id, at_time):
     '''
@@ -220,7 +222,6 @@
     return (None, 0)
 
 
-
 if __name__ == "__main__":
     try:
         pass
diff --git a/tools/scraper/scraper.py b/tools/scraper/scraper.py
index cc618e6..dd019b0 100755
--- a/tools/scraper/scraper.py
+++ b/tools/scraper/scraper.py
@@ -110,19 +110,19 @@
     del argv[0]
     comn.args = p.parse_args(argv)
 
-    if not comn.args.time_start is None:
+    if comn.args.time_start is not None:
         try:
             comn.args.time_start = datetime.datetime.strptime(comn.args.time_start, "%Y-%m-%d %H:%M:%S.%f")
         except:
             sys.exit("ERROR: Failed to parse time_start '%s'. Use format 'YYYY-MM-DD HH:MM:SS.n_uS'" % comn.args.time_start)
 
-    if not comn.args.time_end is None:
+    if comn.args.time_end is not None:
         try:
             comn.args.time_end = datetime.datetime.strptime(comn.args.time_end, "%Y-%m-%d %H:%M:%S.%f")
         except:
             sys.exit("ERROR: Failed to parse time_end '%s'. Use format 'YYYY-MM-DD HH:MM:SS.n_uS'" % comn.args.time_end)
 
-    if not comn.args.log_modules is None:
+    if comn.args.log_modules is not None:
         l = [x.strip() for x in comn.args.log_modules.split(",")]
         comn.verbatim_include_list = [x for x in l if len(x) > 0]
 
@@ -402,7 +402,7 @@
                 print("<td>%s</td><td><a href=\"#cd_%s\">%s</a></td><td>%s</td><td>%s</td><td>%s</td><td>%s</td>"
                       "<td>%d</td><td>%s</td> %s </tr>" %
                       (rid, id, id, rtr.conn_dir[id], peerconnid, peer, rtr.conn_log_lines[id], n_links,
-                       rtr.conn_xfer_bytes[id], conn_details.counts.show_table_data() ))
+                       rtr.conn_xfer_bytes[id], conn_details.counts.show_table_data()))
                 tLines += rtr.conn_log_lines[id]
                 tBytes += rtr.conn_xfer_bytes[id]
     print(
@@ -482,12 +482,14 @@
     # loop to print table with no expanded data
     print("<h4>With transfer data (N=%d)</h4>" % len(w_data))
     print("<table><tr><th>Address</th> <th>N Links</th> <th>Frames</th> <th>Transfers</th> <th>Unsettled</th> </tr>")
-    for line in w_data: print(line)
+    for line in w_data:
+        print(line)
     print("</table>")
 
     print("<h4>With no transfer data (N=%d)</h4>" % len(wo_data))
     print("<table><tr><th>Address</th> <th>N Links</th> <th>Frames</th> <th>Transfers</th> <th>Unsettled</th> </tr>")
-    for line in wo_data: print(line)
+    for line in wo_data:
+        print(line)
     print("</table>")
 
     # loop to print expandable sub tables
@@ -533,7 +535,7 @@
             for rtr in rtrlist:
                 rtr.details.show_html()
     else:
-        print ("details suppressed<br>")
+        print("details suppressed<br>")
     print("<hr>")
 
     # noteworthy log lines: highlight errors and stuff
@@ -546,7 +548,7 @@
     n_aborted = 0
     n_drain = 0
     n_unsettled = 0
-    n_unsettled_no_parent = 0 # without link/session can't match xfers with dispositions
+    n_unsettled_no_parent = 0  # without link/session can't match xfers with dispositions
     for plf in tree:
         if plf.data.amqp_error:
             n_errors += 1
@@ -562,9 +564,9 @@
             n_drain += 1
         if common.transfer_is_possibly_unsettled(plf):
             if plf.data.no_parent_link:
-                n_unsettled_no_parent += 1 # possibly unsettled
+                n_unsettled_no_parent += 1  # possibly unsettled
             else:
-                n_unsettled += 1 # probably unsettled
+                n_unsettled += 1  # probably unsettled
     # amqp errors
     print("<a href=\"javascript:toggle_node('noteworthy_errors')\">%s%s</a> AMQP errors: %d<br>" %
           (text.lozenge(), text.nbsp(), n_errors))
@@ -683,47 +685,47 @@
     print("<a name=\"c_messageprogress\"></a>")
     print("<h3>Message progress</h3>")
     if not comn.args.skip_msg_progress:
-      for i in range(0, comn.shorteners.short_data_names.len()):
-        sname = comn.shorteners.short_data_names.shortname(i)
-        size = 0
-        for plf in comn.shorteners.short_data_names.customers(sname):
-            size = plf.data.transfer_size
-            break
-        print("<a name=\"%s\"></a> <h4>%s (%s)" % (sname, sname, size))
-        print(" <span> <a href=\"javascript:toggle_node('%s')\"> %s</a>" % ("data_" + sname, text.lozenge()))
-        print(" <div width=\"100%%\"; style=\"display:none; font-weight: normal; margin-bottom: 2px\" id=\"%s\">" %
-              ("data_" + sname))
-        print(" ", comn.shorteners.short_data_names.longname(i, True))
-        print("</div> </span>")
-        print("</h4>")
-        print("<table>")
-        print(
-            "<tr><th>Src</th> <th>Time</th> <th>Router</th> <th>ConnId</th> <th>Dir</th> <th>ConnId</th> <th>Peer</th> "
-            "<th>T delta</th> <th>T elapsed</th><th>Settlement</th><th>S elapsed</th></tr>")
-        t0 = None
-        tlast = None
-        for plf in comn.shorteners.short_data_names.customers(sname):
-            if t0 is None:
-                t0 = plf.datetime
-                tlast = plf.datetime
-                delta = "0.000000"
-                epsed = "0.000000"
-            else:
-                delta = time_offset(plf.datetime, tlast)
-                epsed = time_offset(plf.datetime, t0)
-                tlast = plf.datetime
-            sepsed = ""
-            if plf.data.final_disposition is not None:
-                sepsed = time_offset(plf.data.final_disposition.datetime, t0)
-            rid = plf.router.iname
-            peerconnid = "%s" % comn.conn_peers_connid.get(plf.data.conn_id, "")
-            peer = plf.router.conn_peer_display.get(plf.data.conn_id, "")  # peer container id
-            print("<tr><td>%s</td> <td>%s</td> <td>%s</td> <td>%s</td> <td>%s</td> <td>%s</td> "
-                  "<td>%s</td> <td>%s</td> <td>%s</td> <td>%s</td> <td>%s</td> </tr>" %
-                  (plf.adverbl_link_to(), plf.datetime, rid, plf.data.conn_id, plf.data.direction,
-                   peerconnid, peer, delta, epsed,
-                   plf.data.disposition_display, sepsed))
-        print("</table>")
+        for i in range(0, comn.shorteners.short_data_names.len()):
+            sname = comn.shorteners.short_data_names.shortname(i)
+            size = 0
+            for plf in comn.shorteners.short_data_names.customers(sname):
+                size = plf.data.transfer_size
+                break
+            print("<a name=\"%s\"></a> <h4>%s (%s)" % (sname, sname, size))
+            print(" <span> <a href=\"javascript:toggle_node('%s')\"> %s</a>" % ("data_" + sname, text.lozenge()))
+            print(" <div width=\"100%%\"; style=\"display:none; font-weight: normal; margin-bottom: 2px\" id=\"%s\">" %
+                  ("data_" + sname))
+            print(" ", comn.shorteners.short_data_names.longname(i, True))
+            print("</div> </span>")
+            print("</h4>")
+            print("<table>")
+            print(
+                "<tr><th>Src</th> <th>Time</th> <th>Router</th> <th>ConnId</th> <th>Dir</th> <th>ConnId</th> <th>Peer</th> "
+                "<th>T delta</th> <th>T elapsed</th><th>Settlement</th><th>S elapsed</th></tr>")
+            t0 = None
+            tlast = None
+            for plf in comn.shorteners.short_data_names.customers(sname):
+                if t0 is None:
+                    t0 = plf.datetime
+                    tlast = plf.datetime
+                    delta = "0.000000"
+                    epsed = "0.000000"
+                else:
+                    delta = time_offset(plf.datetime, tlast)
+                    epsed = time_offset(plf.datetime, t0)
+                    tlast = plf.datetime
+                sepsed = ""
+                if plf.data.final_disposition is not None:
+                    sepsed = time_offset(plf.data.final_disposition.datetime, t0)
+                rid = plf.router.iname
+                peerconnid = "%s" % comn.conn_peers_connid.get(plf.data.conn_id, "")
+                peer = plf.router.conn_peer_display.get(plf.data.conn_id, "")  # peer container id
+                print("<tr><td>%s</td> <td>%s</td> <td>%s</td> <td>%s</td> <td>%s</td> <td>%s</td> "
+                      "<td>%s</td> <td>%s</td> <td>%s</td> <td>%s</td> <td>%s</td> </tr>" %
+                      (plf.adverbl_link_to(), plf.datetime, rid, plf.data.conn_id, plf.data.direction,
+                       peerconnid, peer, delta, epsed,
+                       plf.data.disposition_display, sepsed))
+            print("</table>")
 
     print("<hr>")
 
@@ -809,6 +811,7 @@
 
     PEER_COST_REBOOT = -1
     PEER_COST_ABSENT = 0
+
     def new_costs_row(val):
         """
         return a costs row.
@@ -835,7 +838,7 @@
     for c in cl:
         if c.event == "ls":
             # link state computed costs and router reachability
-            plf = c.router # cruel overload here: router is a parsed line not a router
+            plf = c.router  # cruel overload here: router is a parsed line not a router
             # Processing: Computed costs: {u'A': 1, u'C': 51L, u'B': 101L}
             print("<tr><td>%s</td> <td>%s</td>" % (plf.datetime, ("%s#%d" % (plf.router.iname, plf.lineno))))
             try:
@@ -879,8 +882,8 @@
             for c_rtr in interior_rtrs:
                 for r_rtr in interior_rtrs:
                     if r_rtr != c_rtr \
-                            and (cur_costs[r_rtr][c_rtr] != cur_costs[c_rtr][r_rtr] \
-                            or cur_costs[c_rtr][r_rtr] <= PEER_COST_ABSENT):
+                            and (cur_costs[r_rtr][c_rtr] != cur_costs[c_rtr][r_rtr]
+                                 or cur_costs[c_rtr][r_rtr] <= PEER_COST_ABSENT):
                         costs_stable = False
                         break
                 if not costs_stable:
@@ -932,7 +935,6 @@
 
     print("<hr>")
 
-
     # Emit data for source to be processed by seq-diag-gen utility
     if comn.args.sequence:
         print("<a name=\"c_sequence\"></a>")
@@ -942,7 +944,7 @@
             rid = comn.router_display_names[rtr.log_index]
             peer = rtr.conn_peer_display.get(plf.data.conn_id, "")
             if peer.startswith("<"):
-                peer = peer[peer.find(">")+1:]
+                peer = peer[peer.find(">") + 1:]
                 peer = peer[:peer.find("<")]
             # TODO: differentiate between peer sender and peer receiver
             # This is not so easy as test code uses the same container id for all connections
@@ -950,17 +952,17 @@
             # to same router.
             if peer.startswith("peer"):
                 peer += "_" + rid
-            #TODO handle EOS, connection open/close lines
+            # TODO handle EOS, connection open/close lines
             if (not plf.data.sdorg_str == "" and
                 not plf.data.direction == "" and
-                not plf.data.sdorg_str.startswith("HELP")):
+                    not plf.data.sdorg_str.startswith("HELP")):
                 print("%s|%s|%s|%s|%s|%s|<br>" % (plf.datetime, rid, plf.data.direction, peer, plf.data.sdorg_str, ("%s#%d" % (plf.prefixi, plf.lineno))))
             else:
                 if plf.data.is_scraper:
                     print("%s|%s|%s|%s|%s|%s|<br>" % (plf.datetime, rid, "->", rid, plf.data.sdorg_str,
-                                                 ("%s#%d" % (plf.prefixi, plf.lineno))))
+                                                      ("%s#%d" % (plf.prefixi, plf.lineno))))
             #import pdb
-            #pdb.set_trace()
+            # pdb.set_trace()
         print("<hr>")
 
     print("</body>")
diff --git a/tools/scraper/seq-diag-gen.py b/tools/scraper/seq-diag-gen.py
index 295a9cf..9272499 100755
--- a/tools/scraper/seq-diag-gen.py
+++ b/tools/scraper/seq-diag-gen.py
@@ -41,6 +41,7 @@
 # Exactly how to predict how much 'space' asynchronous messages take is vague.
 MAGIC_SPACE_NUMBER = 1   # tested with entryspacing 0.1
 
+
 class log_record:
     def __init__(self, index, line):
         # print("DEBUG input line: ", index, line)
@@ -52,9 +53,9 @@
         self.direction = direction.strip()
         self.name_right = name_right.strip()
         self.performative = perf.strip()
-        self.router_line = router_line.strip() # diag
+        self.router_line = router_line.strip()  # diag
         self.peer_log_rec = None
-        dir_out = (direction == '->') # name_left -> name_right
+        dir_out = (direction == '->')  # name_left -> name_right
         self.sentby = name_left.strip() if dir_out else name_right.strip()
         self.rcvdby = name_right.strip() if dir_out else name_left.strip()
 
@@ -93,7 +94,7 @@
                 linediff = int(self.peer_log_rec.index) - int(self.index)
                 space = -MAGIC_SPACE_NUMBER * (linediff - 1)
                 if showtime:
-                    print("%s->(%s)%s:%s %s" %(self.sentby, str(linediff), self.rcvdby, self.time, self.performative))
+                    print("%s->(%s)%s:%s %s" % (self.sentby, str(linediff), self.rcvdby, self.time, self.performative))
                 else:
                     print("%s->(%s)%s:%s" % (self.sentby, str(linediff), self.rcvdby, self.performative))
                 print("space %s" % (str(space)))
@@ -140,8 +141,8 @@
     :param log_lines:
     :return:
     '''
-    for idx in range(len(log_recs)-2):
-        for idx2 in range(idx+1, len(log_recs)-1):
+    for idx in range(len(log_recs) - 2):
+        for idx2 in range(idx + 1, len(log_recs) - 1):
             if log_recs[idx].absorb_peer_rec(log_recs[idx2]):
                 break
 
@@ -166,7 +167,7 @@
             index = 0
             for logline in log_lines:
                 if len(logline) > 0:
-                    log_recs.append( log_record(index, logline) )
+                    log_recs.append(log_record(index, logline))
                     index += 1
             match_logline_pairs(log_recs)
 
@@ -191,7 +192,7 @@
 
             # diag dump
             #print("\nDiag dump")
-            #for log_rec in log_recs:
+            # for log_rec in log_recs:
             #    log_rec.diag_dump()
         else:
             print("Log file has fewer than two lines. I give up.")
diff --git a/tools/scraper/test_data.py b/tools/scraper/test_data.py
index a711931..d6199b6 100755
--- a/tools/scraper/test_data.py
+++ b/tools/scraper/test_data.py
@@ -27,6 +27,7 @@
 import sys
 import traceback
 
+
 class TestData():
     '''
     Extract list of test log lines from a data file.
@@ -34,6 +35,7 @@
     Embedding the lines as a python source code data statement involves escaping
     double quotes and runs the risk of corrupting the data.
     '''
+
     def __init__(self, fn="test_data/test_data.txt"):
         with open(fn, 'r') as f:
             self.lines = [line.rstrip('\n') for line in f]
@@ -47,8 +49,8 @@
     try:
         datasource = TestData()
         for line in datasource.data():
-            print (line)
+            print(line)
         pass
     except:
         traceback.print_exc(file=sys.stdout)
-        pass
\ No newline at end of file
+        pass
diff --git a/tools/scraper/text.py b/tools/scraper/text.py
index bbd71e3..e5515f0 100755
--- a/tools/scraper/text.py
+++ b/tools/scraper/text.py
@@ -57,8 +57,8 @@
 <title>Adverbl Analysis - qpid-dispatch router logs</title>
 
 <style>
-    * { 
-    font-family: sans-serif; 
+    * {
+    font-family: sans-serif;
 }
 table {
     border-collapse: collapse;
@@ -76,7 +76,7 @@
 {
   if(dojo.isString(node))
     node = dojo.byId(node);
-  if(!node) 
+  if(!node)
     return false;
   return node.style.display == "block";
 }