code: def filter_for_probability(self, population: Union[pd.DataFrame, pd.Series, Index],
                                 probability: Array, additional_key: Any=None) -> Index:
          
          return filter_for_probability(self._key(additional_key), population, probability, self.index_map)
docs: Decide an event outcome for each individual in a population from probabilities.
  
          Given a population or its index and an array of associated probabilities
          for some event to happen, we create and return the sub-population for whom
          the event occurred.
  
          Parameters
          ----------
          population :
              A view on the simulants for which we are determining the
              outcome of an event.
          probability :
              A 1d list of probabilities of the event under consideration
              occurring which corresponds (i.e. `len(population) == len(probability)`
              to the population view passed in.
          additional_key :
              Any additional information used to create the seed.
  
          Returns
          -------
          Index
              The sub-population of the simulants for whom the event occurred.
              The return type will be the same as type(population)