code: def merge_required_resources(lhs, rhs):
      if not lhs:
          return dict() if rhs is None else rhs
      if not rhs:
          return dict() if lhs is None else lhs
      merged_resources = dict()
      if lhs.get(NOISE, False) or rhs.get(NOISE, False):
          merged_resources[NOISE] = True
      if lhs.get(STOP_WORDS, False) or rhs.get(STOP_WORDS, False):
          merged_resources[STOP_WORDS] = True
      if lhs.get(STEMS, False) or rhs.get(STEMS, False):
          merged_resources[STEMS] = True
      lhs_parser_usage = lhs.get(CUSTOM_ENTITY_PARSER_USAGE)
      rhs_parser_usage = rhs.get(CUSTOM_ENTITY_PARSER_USAGE)
      parser_usage = CustomEntityParserUsage.merge_usages(
          lhs_parser_usage, rhs_parser_usage
      )
      merged_resources[CUSTOM_ENTITY_PARSER_USAGE] = parser_usage
      gazetteers = lhs.get(GAZETTEERS, set()).union(
          rhs.get(GAZETTEERS, set())
      )
      if gazetteers:
          merged_resources[GAZETTEERS] = gazetteers
      word_clusters = lhs.get(WORD_CLUSTERS, set()).union(
          rhs.get(WORD_CLUSTERS, set())
      )
      if word_clusters:
          merged_resources[WORD_CLUSTERS] = word_clusters
      return merged_resources
  
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 12 for calling a global function with example usage: merge_required_resources(lhs, rhs) and returns: merged_resources, unknown, unknown