def OwnerCcsInvolvedInFilterRules(rules):
  """Finds all user_ids in the given rules and returns them.

  Args:
    rules: a list of FilterRule PBs.

  Returns:
    A set of user_ids.
  """
  user_ids = set()
  for rule in rules:
    if rule.default_owner_id:
      user_ids.add(rule.default_owner_id)
    user_ids.update(rule.add_cc_ids)
  return user_ids