def _abilities(self, fn=None):
    """Return the list of abilities filtered by `fn`."""
    out = {}
    for cmd in self._obs.observation.abilities:
      ability = _Ability(cmd, self._static_data.abilities)
      if not fn or fn(ability):
        out[ability.ability_id] = ability
    return list(out.values())
Return the list of abilities filtered by `fn`.