code: def persist_resources(
      resources, resources_dest_path, required_resources
  ):
      if not required_resources:
          return
  
      resources_dest_path.mkdir()
      metadata = deepcopy(resources[METADATA])
  
      # Update metadata and keep only required resources
      if not required_resources.get(NOISE, False):
          metadata[NOISE] = None
      if not required_resources.get(STOP_WORDS, False):
          metadata[STOP_WORDS] = None
      if not required_resources.get(STEMS, False):
          metadata[STEMS] = None
  
      metadata[GAZETTEERS] = sorted(
          required_resources.get(GAZETTEERS, [])
      )
      metadata[WORD_CLUSTERS] = sorted(
          required_resources.get(WORD_CLUSTERS, [])
      )
      metadata_dest_path = resources_dest_path / "metadata.json"
      metadata_json = json_string(metadata)
      with metadata_dest_path.open(encoding="utf8", mode="w") as f:
          f.write(metadata_json)
  
      if metadata[NOISE] is not None:
          noise_path = (
              resources_dest_path / metadata[NOISE]
          ).with_suffix(".txt")
          _persist_noise(get_noise(resources), noise_path)
  
      if metadata[STOP_WORDS] is not None:
          stop_words_path = (
              resources_dest_path / metadata[STOP_WORDS]
          ).with_suffix(".txt")
          _persist_stop_words(
              get_stop_words(resources), stop_words_path
          )
  
      if metadata[STEMS] is not None:
          stemming_dir = resources_dest_path / "stemming"
          stemming_dir.mkdir()
          stems_path = (stemming_dir / metadata[STEMS]).with_suffix(
              ".txt"
          )
          _persist_stems(get_stems(resources), stems_path)
  
      if metadata[GAZETTEERS]:
          gazetteers_dir = resources_dest_path / "gazetteers"
          gazetteers_dir.mkdir()
          for name in metadata[GAZETTEERS]:
              gazetteer_path = (gazetteers_dir / name).with_suffix(
                  ".txt"
              )
              _persist_gazetteer(
                  get_gazetteer(resources, name), gazetteer_path
              )
  
      if metadata[WORD_CLUSTERS]:
          clusters_dir = resources_dest_path / "word_clusters"
          clusters_dir.mkdir()
          for name in metadata[WORD_CLUSTERS]:
              clusters_path = (clusters_dir / name).with_suffix(".txt")
              _persist_word_clusters(
                  get_word_cluster(resources, name), clusters_path
              )
  
imports: from __future__ import unicode_literals
  import json
  from collections import defaultdict
  from copy import deepcopy
  from pathlib import Path
  from future.utils import iteritems
  from snips_nlu.common.utils import get_package_path, is_package, json_string
  from snips_nlu.constants import CUSTOM_ENTITY_PARSER_USAGE, DATA_PATH, GAZETTEERS, NOISE, STEMS, STOP_WORDS, WORD_CLUSTERS, METADATA
  from snips_nlu.entity_parser.custom_entity_parser import CustomEntityParserUsage
label_desc: Use image node_id 13 for calling a global function with example usage: persist_resources(resources, resources_dest_path, required_resources) without return types