code: def mark_flags_as_mutual_exclusive(flag_names, required=False,
                                     flag_values=FLAGS):
    
  
    def validate_mutual_exclusion(flags_dict):
      flag_count = sum(1 for val in flags_dict.values() if val is not None)
      if flag_count == 1 or (not required and flag_count == 0):
        return True
      message = ('%s one of (%s) must be specified.' %
                 ('Exactly' if required else 'At most', ', '.join(flag_names)))
      raise ValidationError(message)
  
    register_multi_flags_validator(
        flag_names, validate_mutual_exclusion, flag_values=flag_values)
docs: Ensures that only one flag among flag_names is set.
  
    Args:
      flag_names: [str], a list of the flag names to be checked.
      required: Boolean, if set, exactly one of the flags must be set.
          Otherwise, it is also valid for none of the flags to be set.
      flag_values: An optional FlagValues instance to validate against.