<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def resample( self, rule: Union[str, int] = "1s", max_workers: int = 4, ) -> "Traffic": """Resamples all trajectories, flight by flight. `rule` defines the desired sample rate (default: 1s) """


        with ProcessPoolExecutor(max_workers=max_workers) as executor:
            cumul = []
            tasks = {
                executor.submit(flight.resample, rule): flight
                for flight in self
            }
            for future in tqdm(as_completed(tasks), total=len(tasks)):
                cumul.append(future.result())

        return self.__class__.from_flights(cumul)