def get_featured_activity_summary_dicts(language_codes):
 activity_references = activity_services.get_featured_activity_references()
 (exploration_ids, collection_ids) = activity_services.split_by_type(activity_references)
 exp_summary_dicts = get_displayable_exp_summary_dicts_matching_ids(exploration_ids)
 col_summary_dicts = get_displayable_collection_summary_dicts_matching_ids(collection_ids)
 summary_dicts_by_id = {feconf.ACTIVITY_TYPE_EXPLORATION: {summary_dict['id']: summary_dict for summary_dict in exp_summary_dicts}, feconf.ACTIVITY_TYPE_COLLECTION: {summary_dict['id']: summary_dict for summary_dict in col_summary_dicts}}
 featured_summary_dicts = []
 for reference in activity_references:
  if (reference.id in summary_dicts_by_id[reference.type]):
   summary_dict = summary_dicts_by_id[reference.type][reference.id]
   if (summary_dict and (summary_dict['language_code'] in language_codes)):
    featured_summary_dicts.append(summary_dict)
 return featured_summary_dicts

def get_featured_activity_summary_dicts ( language_codes ) : activity_references = activity_services . get_featured_activity_references ( ) ( exploration_ids , collection_ids ) = activity_services . split_by_type ( activity_references ) exp_summary_dicts = get_displayable_exp_summary_dicts_matching_ids ( exploration_ids ) col_summary_dicts = get_displayable_collection_summary_dicts_matching_ids ( collection_ids ) summary_dicts_by_id = { feconf . ACTIVITY_TYPE_EXPLORATION : { summary_dict [ 'id' ] : summary_dict for summary_dict in exp_summary_dicts } , feconf . ACTIVITY_TYPE_COLLECTION : { summary_dict [ 'id' ] : summary_dict for summary_dict in col_summary_dicts } } featured_summary_dicts = [ ] for reference in activity_references : if ( reference . id in summary_dicts_by_id [ reference . type ] ) : summary_dict = summary_dicts_by_id [ reference . type ] [ reference . id ] if ( summary_dict and ( summary_dict [ 'language_code' ] in language_codes ) ) : featured_summary_dicts . append ( summary_dict ) return featured_summary_dicts
returns a list of featured activities with the given language codes .