@staticmethod
     def getInstance():
         """ Static access method. """
-        if Connection.__instance == None:
+        if Connection.__instance is None:
             Connection()
         return Connection.__instance
 
     def __init__(self):
         """ Virtually private constructor. """
-        if Connection.__instance != None:
+        if Connection.__instance is not None:
             raise Exception("This class is a singleton!")
-        else:
-            from binhoHostAdapter import binhoHostAdapter
-            from binhoHostAdapter import binhoUtilities
 
-            utilities = binhoUtilities.binhoUtilities()
-            devices = utilities.listAvailableDevices()
+        from binhoHostAdapter import binhoHostAdapter
+        from binhoHostAdapter import binhoUtilities
+
+        utilities = binhoUtilities.binhoUtilities()
+        devices = utilities.listAvailableDevices()
 
-            if len(devices) > 0:
-                Connection.__instance = binhoHostAdapter.binhoHostAdapter(devices[0])
-            else:
-                raise RuntimeError('No Binho Nova found!')
\ No newline at end of file
+        if len(devices) > 0:
+            Connection.__instance = binhoHostAdapter.binhoHostAdapter(devices[0])
+        else:
+            raise RuntimeError('No Binho Nova found!')
 
             for i in range(len(buffer_in[in_start:in_end])):
                 buffer_in[in_start+i] = int(resp[2+i])
         else:
-            raise RuntimeError("Received error response from Binho Nova, result = " + result)
\ No newline at end of file
+            raise RuntimeError("Received error response from Binho Nova, result = " + result)
 
         if val is None:
             return int(Pin._nova.getIOpinValue(self.id).split('VALUE ')[1])
         # write
-        elif val in (self.LOW, self.HIGH):
+        if val in (self.LOW, self.HIGH):
             Pin._nova.setIOpinValue(self.id, val)
         else:
             raise RuntimeError("Invalid value for pin")
 SCK = SCLK = IO3
 MOSI = IO4
 MISO = IO2
-SS0  = IO0
-SS1  = IO1
+SS0 = IO0
+SS1 = IO1
 
 PWM0 = IO0
 # No PWM support on IO1
 PWM4 = IO4
 
 # orderd as (channel, pin), id
-pwmOuts = ( ((1, 0), PWM0), ((1, 2), PWM2), ((1, 3), PWM3), ((1, 4), PWM4) )
+pwmOuts = (((1, 0), PWM0), ((1, 2), PWM2), ((1, 3), PWM3), ((1, 4), PWM4))
 
 UART1_TX = IO4
 UART1_RX = IO3
 
 # ordered as uartId, txId, rxId
-uartPorts = ( (0, UART1_TX, UART1_RX), )
\ No newline at end of file
+uartPorts = ((0, UART1_TX, UART1_RX), )
\ No newline at end of file
 
-import os
-import digitalio
 
 try:
     from microcontroller.pin import pwmOuts
             from adafruit_blinka.microcontroller.nova import Connection
             PWMOut._nova = Connection.getInstance()
 
+        PWMOut._nova.setOperationMode(0, 'IO')
         self._pwmpin = None
         self._open(pin, duty_cycle, frequency, variable_frequency)
 
         self._set_enabled(True)
 
     def deinit(self):
-      try:
-        """Deinit the Nova PWM."""
-        if self._channel is not None:
-            #self.duty_cycle = 0
-            self._set_enabled(False) # make to disable before unexport
-
-      except Exception as e:
-          # due to a race condition for which I have not yet been
-          # able to find the root cause, deinit() often fails
-          # but it does not effect future usage of the pwm pin
-          print("warning: failed to deinitialize pwm pin {0}:{1} due to: {2}\n".format(self._channel, self._pwmpin, type(e).__name__))
-      finally:
-          self._channel = None
-          self._pwmpin = None
+        try:
+            """Deinit the Nova PWM."""
+            if self._channel is not None:
+                #self.duty_cycle = 0
+                self._set_enabled(False) # make to disable before unexport
+
+        except Exception as e:
+            # due to a race condition for which I have not yet been
+            # able to find the root cause, deinit() often fails
+            # but it does not effect future usage of the pwm pin
+            print("warning: failed to deinitialize pwm pin {0}:{1} due to: {2}\n".format(self._channel, self._pwmpin, type(e).__name__))
+        finally:
+            self._channel = None
+            self._pwmpin = None
 
     def _is_deinited(self):
         if self._pwmpin is None:
 
         #  3     1    1
 
     def init(self, baudrate=100000, polarity=0, phase=0, bits=8,
-                  firstbit=MSB, sck=None, mosi=None, miso=None):
+             firstbit=MSB, sck=None, mosi=None, miso=None):
         #print("baudrate: " + str(baudrate))
         #print("mode: " + str((polarity<<1) | (phase)))
         self._nova.setClockSPI(0, baudrate)
         self._nova.setModeSPI(0, (polarity<<1) | (phase))
 
     @staticmethod
-    def getSpiReceivedData(lineOutput):
+    def get_received_data(lineOutput):
         return (lineOutput.split('RXD ')[1])
 
     @property
     def readinto(self, buf, start=0, end=None, write_value=0):
         end = end if end else len(buf)
         for i in range(start, end):
-            buf[start+i] = int(self.getSpiReceivedData(self._nova.transferSPI(0, write_value)))
+            buf[start+i] = int(self.get_received_data(self._nova.transferSPI(0, write_value)))
 
-    def write_readinto(self, buffer_out, buffer_in,  out_start=0, out_end=None, in_start=0, in_end=None):
+    def write_readinto(self, buffer_out, buffer_in, out_start=0, out_end=None, in_start=0, in_end=None):
         out_end = out_end if out_end else len(buffer_out)
         in_end = in_end if in_end else len(buffer_in)
         readlen = in_end-in_start
             buffer_out = tmp
         i = 0
         for data_out in buffer_out:
-            data_in = int(self.getSpiReceivedData(self._nova.transferSPI(0, data_out)))
+            data_in = int(self.get_received_data(self._nova.transferSPI(0, data_out)))
             if i < readlen:
                 buffer_in[in_start+i] = data_in
             i += 1
 
         return line
 
     def write(self, buf):
-        return self._nova.writeBridgeUART(buf)
\ No newline at end of file
+        return self._nova.writeBridgeUART(buf)