diff --git a/xos/synchronizer/steps/sync_onos_app.py b/xos/synchronizer/steps/sync_onos_app.py
index d9b0f4c..210f8ce 100644
--- a/xos/synchronizer/steps/sync_onos_app.py
+++ b/xos/synchronizer/steps/sync_onos_app.py
@@ -27,6 +27,7 @@
 log = create_logger(Config().get('logging'))
 log.info("config file", file=Config().get_config_file())
 
+
 class SyncONOSApp(SyncStep):
     provides = [ONOSApp]
     observes = [ONOSApp, ServiceInstanceAttribute]
@@ -44,21 +45,25 @@
         """
         if not deps:
             return True
-        for dep in [x.strip() for x in deps.split(',') if x is not ""]:
+        for dep in [x.strip() for x in deps.split(',') if x != ""]:
             try:
                 app = ONOSApp.objects.get(app_id=dep)
                 if not app.backend_code == 1:
                     # backend_code == 1 means that the app has been pushed
                     return False
-            except IndexError, e:
+            except IndexError:
                 return False
         return True
 
     def add_config(self, o):
         log.info("Adding config %s" % o.name, model=o.tologdict())
         # getting onos url and auth
-        onos_url = "%s:%s" % (Helpers.format_url(o.service_instance.leaf_model.owner.leaf_model.rest_hostname), o.service_instance.leaf_model.owner.leaf_model.rest_port)
-        onos_basic_auth = HTTPBasicAuth(o.service_instance.leaf_model.owner.leaf_model.rest_username, o.service_instance.leaf_model.owner.leaf_model.rest_password)
+        onos_url = "%s:%s" % (Helpers.format_url(
+            o.service_instance.leaf_model.owner.leaf_model.rest_hostname),
+            o.service_instance.leaf_model.owner.leaf_model.rest_port)
+        onos_basic_auth = HTTPBasicAuth(
+            o.service_instance.leaf_model.owner.leaf_model.rest_username,
+            o.service_instance.leaf_model.owner.leaf_model.rest_password)
 
         # push configs (if any)
         url = o.name
@@ -145,10 +150,14 @@
 
         if request.status_code != 200:
             log.error("Request failed", response=request.text)
-            raise Exception("Failed to read application %s from ONOS: %s while checking correct version" % (url, request.text))
+            raise Exception(
+                "Failed to read application %s from ONOS: %s while checking correct version" %
+                (url, request.text))
         else:
             if o.version != request.json()["version"]:
-                raise Exception("The version of %s you installed (%s) is not the same you requested (%s)" % (o.app_id, request.json()["version"], o.version))
+                raise Exception(
+                    "The version of %s you installed (%s) is not the same you requested (%s)" %
+                    (o.app_id, request.json()["version"], o.version))
 
     def sync_record(self, o):
         log.info("Sync'ing", model=o.tologdict())
@@ -156,7 +165,7 @@
             # this is a ServiceInstanceAttribute model just push the config
             if 'ONOSApp' in o.service_instance.leaf_model.class_names:
                 return self.add_config(o)
-            return # if it's not an ONOSApp do nothing
+            return  # if it's not an ONOSApp do nothing
 
         if not self.check_app_dependencies(o.dependencies):
             raise DeferredException('Deferring installation of ONOSApp with id %s as dependencies are not met' % o.id)
@@ -176,8 +185,12 @@
         log.info("Deleting config %s" % o.name)
         # getting onos url and auth
         onos_app = o.service_instance.leaf_model
-        onos_url = "%s:%s" % (Helpers.format_url(onos_app.owner.leaf_model.rest_hostname), onos_app.owner.leaf_model.rest_port)
-        onos_basic_auth = HTTPBasicAuth(onos_app.owner.leaf_model.rest_username, onos_app.owner.leaf_model.rest_password)
+        onos_url = "%s:%s" % (Helpers.format_url(
+            onos_app.owner.leaf_model.rest_hostname),
+            onos_app.owner.leaf_model.rest_port)
+        onos_basic_auth = HTTPBasicAuth(
+            onos_app.owner.leaf_model.rest_username,
+            onos_app.owner.leaf_model.rest_password)
 
         url = o.name
         if url[0] == "/":
@@ -191,7 +204,7 @@
             log.error("Request failed", response=request.text)
             raise Exception("Failed to remove config %s from ONOS:  %s" % (url, request.text))
 
-    def uninstall_app(self,o, onos_url, onos_basic_auth):
+    def uninstall_app(self, o, onos_url, onos_basic_auth):
         log.info("Uninstalling app %s" % o.app_id)
         url = '%s/onos/v1/applications/%s' % (onos_url, o.app_id)
 
@@ -217,7 +230,7 @@
             # this is a ServiceInstanceAttribute model
             if 'ONOSApp' in o.service_instance.leaf_model.class_names:
                 return self.delete_config(o)
-            return # if it's not related to an ONOSApp do nothing
+            return  # if it's not related to an ONOSApp do nothing
 
         # NOTE if it is an ONOSApp we don't care about the ServiceInstanceAttribute
         # as the reaper will delete it
