code: def exit(self):
          
          # First detach all servo's, otherwise it somehow doesn't want to close...
          if hasattr(self, 'digital'):
              for pin in self.digital:
                  if pin.mode == SERVO:
                      pin.mode = OUTPUT
          if hasattr(self, 'sp'):
              self.sp.close()
docs: Call this to exit cleanly.