code: def choose_trial_to_run(self, trial_runner):
          
  
          candidates = []
          for trial in trial_runner.get_trials():
              if trial.status in [Trial.PENDING, Trial.PAUSED] and \
                      trial_runner.has_resources(trial.resources):
                  candidates.append(trial)
          candidates.sort(
              key=lambda trial: self._trial_state[trial].last_perturbation_time)
          return candidates[0] if candidates else None
docs: Ensures all trials get fair share of time (as defined by time_attr).
  
          This enables the PBT scheduler to support a greater number of
          concurrent trials than can fit in the cluster at any given time.