code: def process_dirs(args):
      dirs = sorted(os.listdir(args.input_dir))
      resources = {}
      if args.lang:
          resources = json.load(
              open(os.path.join(args.output_dir, "resources.json"))
          )
          # this one language gets overridden
          # if this is not done, and we reuse the old resources,
          # any models which were deleted will still be in the resources
          resources[args.lang] = {}
  
      for model_dir in dirs:
          print(f"Processing models in {model_dir}")
          models = sorted(
              os.listdir(os.path.join(args.input_dir, model_dir))
          )
          for model in tqdm(models):
              if not model.endswith(".pt"):
                  continue
              # get processor
              lang, package, processor = split_model_name(model)
              if args.lang and lang != args.lang:
                  continue
  
              # copy file
              input_path = os.path.join(
                  args.input_dir, model_dir, model
              )
              output_path = os.path.join(
                  args.output_dir,
                  lang,
                  "models",
                  processor,
                  package + ".pt",
              )
              copy_file(input_path, output_path)
              # maintain md5
              md5 = get_md5(output_path)
              # maintain dependencies
              dependencies = get_dependencies(processor, lang, package)
              # maintain resources
              if lang not in resources:
                  resources[lang] = {}
              if processor not in resources[lang]:
                  resources[lang][processor] = {}
              if dependencies:
                  resources[lang][processor][package] = {
                      "md5": md5,
                      "dependencies": dependencies,
                  }
              else:
                  resources[lang][processor][package] = {"md5": md5}
      print(
          "Processed initial model directories.  Writing preliminary resources.json"
      )
      json.dump(
          resources,
          open(os.path.join(args.output_dir, "resources.json"), "w"),
          indent=2,
      )
  
imports: import argparse
  from collections import defaultdict
  import json
  import os
  from pathlib import Path
  import hashlib
  import shutil
  import zipfile
  from stanza import __resources_version__
  from stanza.models.common.constant import lcode2lang, two_to_three_letters, three_to_two_letters
  from stanza.resources.default_packages import PACKAGES, TRANSFORMERS, TRANSFORMER_NICKNAMES
  from stanza.resources.default_packages import *
  from stanza.utils.get_tqdm import get_tqdm
label_desc: Use image node_id 21 for calling a global function with example usage: process_dirs(args) without return types