code: def extract_unassigned_subfolder_entities(subfolder, nkjp_dir):
      """
      Build and return a map from par_id to extracted entities
      """
      ner_path = os.path.join(nkjp_dir, subfolder, NER_FILE)
      rt = parse_xml(ner_path)
      if rt is None:
          return None
      subfolder_entities = {}
      ner_pars = rt.findall(
          "{%s}TEI/{%s}text/{%s}body/{%s}p"
          % (NAMESPACE, NAMESPACE, NAMESPACE, NAMESPACE)
      )
      for par in ner_pars:
          par_entities = {}
          _, par_id = get_node_id(par).split("_")
          ner_sents = par.findall("{%s}s" % NAMESPACE)
          for ner_sent in ner_sents:
              corresp = ner_sent.get("corresp")
              _, ner_sent_id = corresp.split("#morph_")
              par_entities[
                  ner_sent_id
              ] = extract_entities_from_sentence(ner_sent)
          subfolder_entities[par_id] = par_entities
      return subfolder_entities
  
imports: import argparse
  import json
  import os
  import random
  import tarfile
  import tempfile
  from tqdm import tqdm
label_desc: Use image node_id 4 for calling a global function with example usage: extract_unassigned_subfolder_entities(subfolder, nkjp_dir) and returns: subfolder_entities, None