code: def sync(self, expectedThreads=0):
          'Wait for all but expectedThreads async threads to finish.'
          while len(self.unfinishedThreads) > expectedThreads:
              time.sleep(.3)
              self.checkForFinishedThreads(f sync(self, expectedThreads=0):
          'Wait for all but expectedThreads async threads to finish.'
          while len(self.unfinishedThreads) > expectedThreads:
              time.sleep(.3)
              self.checkForFinishedThreads()
docs: Wait for all but expectedThreads async threads to finish.