code: def start_scan(self, scan_id, targets, parallel=1):
          os.setsid()
          multiscan_proc = []
          logger.info("%s: Scan started.", scan_id)
          target_list = targets
          if target_list is None or not target_list:
              raise OSPDError('Erroneous targets list', 'start_scan')
          for index, target in enumerate(target_list):
              while len(multiscan_proc) >= parallel:
                  progress = self.calculate_progress(scan_id)
                  self.set_scan_progress(scan_id, progress)
                  multiscan_proc = self.check_pending_target(scan_id,
                                                             multiscan_proc)
                  time.sleep(1)
              if self.get_scan_status(scan_id) == ScanStatus.STOPPED:
                  return
              logger.info("%s: Host scan started on ports %s.", target[0], target[1])
              scan_process = multiprocessing.Process(target=self.parallel_scan,
                                                     args=(scan_id, target[0]))
              multiscan_proc.append((scan_process, target[0]))
              scan_process.start()
              self.set_scan_status(scan_id, ScanStatus.RUNNING)
          while multiscan_proc:
              multiscan_proc = self.check_pending_target(scan_id, multiscan_proc)
              if multiscan_proc:
                  progress = self.calculate_progress(scan_id)
                  self.set_scan_progress(scan_id, progress)
              time.sleep(1)
          if self.get_scan_status(scan_id) != ScanStatus.STOPPED:
              self.finish_scan(scan_id)