code: def resolve_entity(entity, entities):
      # translate targets defined in terms of entities, into morphological units
      # works recurrently
      targets = entity["targets"]
      resolved = []
      for target in targets:
          if target.startswith("named_"):
              target_entity = entities[target]
              resolved.extend(resolve_entity(target_entity, entities))
          else:
              resolved.append(target)
      return resolved
  
imports: import argparse
  import json
  import os
  import random
  import tarfile
  import tempfile
  from tqdm import tqdm
label_desc: Use image node_id 8 for calling a global function with example usage: resolve_entity(entity, entities) and returns: resolved