def validate_mapped_group_ids(group_ids, mapping_id, identity_api):
 for group_id in group_ids:
  try:
   identity_api.get_group(group_id)
  except exception.GroupNotFound:
   raise exception.MappedGroupNotFound(group_id=group_id, mapping_id=mapping_id)

def validate_mapped_group_ids ( group_ids , mapping_id , identity_api ) : for group_id in group_ids : try : identity_api . get_group ( group_id ) except exception . GroupNotFound : raise exception . MappedGroupNotFound ( group_id = group_id , mapping_id = mapping_id )
iterate over group ids and make sure they are present in the backend .