def transform_to_group_ids(group_names, mapping_id, identity_api, resource_api):
 def resolve_domain(domain):
  "Return domain id.\n\n        Input is a dictionary with a domain identified either by a ``id`` or a\n        ``name``. In the latter case system will attempt to fetch domain object\n        from the backend.\n\n        :returns: domain's id\n        :rtype: str\n\n        "
  domain_id = (domain.get('id') or resource_api.get_domain_by_name(domain.get('name')).get('id'))
  return domain_id
 for group in group_names:
  try:
   group_dict = identity_api.get_group_by_name(group['name'], resolve_domain(group['domain']))
   (yield group_dict['id'])
  except exception.GroupNotFound:
   raise exception.MappedGroupNotFound(group_id=group['name'], mapping_id=mapping_id)

def transform_to_group_ids ( group_names , mapping_id , identity_api , resource_api ) : def resolve_domain ( domain ) : domain_id = ( domain . get ( 'id' ) or resource_api . get_domain_by_name ( domain . get ( 'name' ) ) . get ( 'id' ) ) return domain_id for group in group_names : try : group_dict = identity_api . get_group_by_name ( group [ 'name' ] , resolve_domain ( group [ 'domain' ] ) ) ( yield group_dict [ 'id' ] ) except exception . GroupNotFound : raise exception . MappedGroupNotFound ( group_id = group [ 'name' ] , mapping_id = mapping_id )
transform groups identified by name/domain to their ids .