code: def _get_entity_scopes(dataset):
      intent_entities = extract_intent_entities(dataset)
      intent_groups = []
      entity_scopes = []
      for intent, entities in sorted(iteritems(intent_entities)):
          scope = {
              "builtin": list(
                  {ent for ent in entities if is_builtin_entity(ent)}
              ),
              "custom": list(
                  {
                      ent
                      for ent in entities
                      if not is_builtin_entity(ent)
                  }
              ),
          }
          if scope in entity_scopes:
              group_idx = entity_scopes.index(scope)
              intent_groups[group_idx].append(intent)
          else:
              entity_scopes.append(scope)
              intent_groups.append([intent])
      return [
          {"intent_group": intent_group, "entity_scope": entity_scope}
          for intent_group, entity_scope in zip(
              intent_groups, entity_scopes
          )
      ]
  
imports: from __future__ import unicode_literals
  import json
  import logging
  from builtins import str
  from collections import defaultdict
  from itertools import combinations
  from pathlib import Path
  from future.utils import iteritems, itervalues
  from snips_nlu_utils import normalize, hash_str
  from snips_nlu.common.log_utils import log_elapsed_time, log_result
  from snips_nlu.common.utils import check_persisted_path, deduplicate_overlapping_entities, fitted_required, json_string
  from snips_nlu.constants import DATA, END, ENTITIES, ENTITY, ENTITY_KIND, INTENTS, LANGUAGE, RES_INTENT, RES_INTENT_NAME, RES_MATCH_RANGE, RES_SLOTS, SLOT_NAME, START, TEXT, UTTERANCES, RES_PROBA
  from snips_nlu.dataset import validate_and_format_dataset, extract_intent_entities
  from snips_nlu.dataset.utils import get_stop_words_whitelist
  from snips_nlu.entity_parser.builtin_entity_parser import is_builtin_entity
  from snips_nlu.exceptions import IntentNotFoundError, LoadingError
  from snips_nlu.intent_parser.intent_parser import IntentParser
  from snips_nlu.pipeline.configs import LookupIntentParserConfig
  from snips_nlu.preprocessing import tokenize_light
  from snips_nlu.resources import get_stop_words
  from snips_nlu.result import empty_result, intent_classification_result, parsing_result, unresolved_slot, extraction_result
label_desc: Use image node_id 1 for calling a global function with example usage: _get_entity_scopes(dataset) and returns: unknown