diff --git a/lib/xos-util/xosutil/autoversion_setup.py b/lib/xos-util/xosutil/autoversion_setup.py
index 5a7ea44..e027d5c 100644
--- a/lib/xos-util/xosutil/autoversion_setup.py
+++ b/lib/xos-util/xosutil/autoversion_setup.py
@@ -1,4 +1,3 @@
-
 # Copyright 2017-present Open Networking Foundation
 #
 # Licensed under the Apache License, Version 2.0 (the "License");
@@ -33,42 +32,47 @@
 import inspect
 from autodiscover_version import autodiscover_version
 
+
 class SdistCommand(sdist):
     def copy_file(self, infile, outfile, *args, **kwargs):
         if kwargs.get("dry_run"):
             return (outfile, 1)
-        if (os.path.split(outfile)[1] == "version.py"):
-            open(outfile, "w").write("# do not edit. Autogenerated file.\n" \
-                                     "__version__ = '%s'\n" % self.distribution.metadata.version)
+        if os.path.split(outfile)[1] == "version.py":
+            open(outfile, "w").write(
+                "# do not edit. Autogenerated file.\n"
+                "__version__ = '%s'\n" % self.distribution.metadata.version
+            )
             return (outfile, 1)
         else:
             return sdist.copy_file(self, infile, outfile, *args, **kwargs)
 
+
 class BuildPyCommand(build_py):
     def copy_file(self, infile, outfile, *args, **kwargs):
         if kwargs.get("dry_run"):
             return (outfile, 1)
-        if (os.path.split(outfile)[1] == "version.py"):
-            open(outfile, "w").write("# do not edit. Autogenerated file.\n" \
-                                     "__version__ = '%s'\n" % self.distribution.metadata.version)
+        if os.path.split(outfile)[1] == "version.py":
+            open(outfile, "w").write(
+                "# do not edit. Autogenerated file.\n"
+                "__version__ = '%s'\n" % self.distribution.metadata.version
+            )
             return (outfile, 1)
         else:
             return build_py.copy_file(self, infile, outfile, *args, **kwargs)
 
+
 def setup_with_auto_version(*args, **kwargs):
     # Learn the module that called this function, so we can search for any VERSION files in it.
     frame = inspect.stack()[1]
     caller_module = inspect.getmodule(frame[0])
 
     # Search for a VERSION file and extract the version number from it.
-    version = autodiscover_version(caller_filename = caller_module.__file__)
+    version = autodiscover_version(caller_filename=caller_module.__file__)
     if version:
         kwargs["version"] = version
 
     cmdclass = kwargs.get("cmdclass", {}).copy()
-    cmdclass.update( {"sdist": SdistCommand,
-                "build_py": BuildPyCommand} )
+    cmdclass.update({"sdist": SdistCommand, "build_py": BuildPyCommand})
     kwargs["cmdclass"] = cmdclass
 
     return setup(*args, **kwargs)
-
