def FlagBelongsToRequiredGroup(flag_dict, flag_groups):
  """Returns whether the passed flag belongs to a required flag group.

  Args:
    flag_dict: a specific flag's dictionary as found in the gcloud_tree
    flag_groups: a dictionary of flag groups as found in the gcloud_tree

  Returns:
    True if the flag belongs to a required group, False otherwise.
  """
  flag_group = flag_dict.get('group', None)
  flag_group_properties = flag_groups.get(flag_group, {})
  return flag_group_properties.get('is_required', False)